0

I have python 3.8.10 (32-bit) and 3.9.7 (64.bit) installed on my system:

I am trying to compare two version strings in Python so I used the code from here, especially below:

from pkg_resources import packaging

packaging.version.parse("0.1.1rc1") < packaging.version.parse("0.1.1rc2")

I am using VS Code and for some reason it says pkg_resources cannot be resolved.

I have installed packaging package in my system using below for both python versions:

py -m pip install packaging
python -m pip install packaging

and also setuptools:

py -m pip install setuptools
python -m pip install setuptools

However from python terminal, if i do "from pkg_resources import packaging" it works.

Below the list of packages installed for each python version.

python 3.9.7: py -m pip list

enter image description here

python 3.8.10: python -m pip list

enter image description here

Willy
  • 9,848
  • 22
  • 141
  • 284
  • the code should be ``` from packaging import version version.parse(...) ``` – MrE Jun 08 '23 at 23:32
  • @MrE using from packaging import version i get the same error, packaging module cannot be resolved. – Willy Jun 09 '23 at 07:48
  • @MrE I think it is a problem related to VS Code as if I execute my script it is working. – Willy Jun 09 '23 at 10:57
  • did you select the right Python interpreter where you installed the package? – MrE Jun 09 '23 at 20:53

0 Answers0