简体   繁体   中英

Pip lists versions of the package incompatible with the version of Python

I have a virtual environment with python 3.5.2 installed.

If I try to install Pandas with a fake version number, by doing for example pip install Pandas==x i can see that the matching distributions are:

Could not find a version that satisfies the requirement Pandas==xx (from versions: 0.1, 0.2b0, 0.2b1, 0.2, 0.3.0b0, 0.3.0b2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0rc1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0rc1, 0.8.0rc2, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0rc1, 0.19.0, 0.19.1, 0.19.2, 0.20.0rc1, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0rc1, 0.21.0, 0.21.1, 0.22.0, 0.23.0rc2, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0rc1, 0.24.0, 0.24.1, 0.24.2, 0.25.0rc0, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0rc0, 1.0.0) No matching distribution found for Pandas==x

This means that Pandas==1.0.0 should be available, however, when I try to install it I get the following error:

 Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-uc6w1vdn/pandas/setup.py", line 42 f"numpy >= {min_numpy_ver}", ^ SyntaxError: invalid syntax

Because it uses f-string, available from python 3.6 onwards.

Why does pip show incompatible versions? Shouldn't it show only versions I am able to install?

Apparently, pip is showing all of the available versions of the package irrespective of the Python version requirement.

The following part of the documentation suggests that:

Since version 6.0, pip also supports specifiers containing environment markers like so:

 SomeProject ==5.4 ; python_version < '2.7' SomeProject; sys_platform == 'win32'

python_version is specified separately from the version of the package.

You can set it in the following way in when running pip (defaults to the interpreter version):

pip install --python-version= pandas==

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM