问题:找不到满足要求的版本

我正在使用以下requirements.txt文件在Ubuntu 12.04中安装几个Python软件包:

numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0

和这两个命令:

$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt

(第一个下载软件包,第二个安装软件包)。

该过程经常因错误而停止:

  Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))

我用以下方法手动修复:

pip install --user <package>

然后pip install再次运行第二个命令。

但这仅适用于特定程序包。当我pip install再次运行第二个命令时,该过程现在停止,并抱怨另一个必需的程序包,我需要再次重复该过程,即:手动安装新的必需程序包(使用上面的命令),然后运行第二个pip install命令。

到目前为止,我不得不手动安装sixpytznose,现在它在抱怨需要mock

有没有办法告诉pip您自动安装所有需要的依赖项,所以我不必一个个手动地进行安装?

添加:这仅在Ubuntu 12.04 BTW中发生。在Ubuntu 14.04中,pip install应用于requirements.txt文件的命令可以正常工作。

I’m installing several Python packages in Ubuntu 12.04 using the following requirements.txt file:

numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0

and these two commands:

$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt

(the first one downloads the packages and the second one installs them).

The process is frequently stopped with the error:

  Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))

which I fix manually with:

pip install --user <package>

and then run the second pip install command again.

But that only works for that particular package. When I run the second pip install command again, the process is stopped now complaining about another required package and I need to repeat the process again, ie: install the new required package manually (with the command above) and then run the second pip install command.

So far I’ve had to manually install six, pytz, nose, and now it’s complaining about needing mock.

Is there a way to tell pip to automatically install all needed dependencies so I don’t have to do it manually one by one?

Add: This only happens in Ubuntu 12.04 BTW. In Ubuntu 14.04 the pip install commands applied on the requirements.txt file work without issues.


回答 0

仅当目录包含所有软件包时,此方法(在目录中具有所有依赖项,而不是从索引下载)才有效。因此,该目录应包含所有依赖项,还应包含这些依赖项所依赖的所有包(例如sixpytz等)。

因此,您应该手动将它们包括在其中requirements.txt(以便第一步明确下载它们),或者应该使用PyPI安装所有软件包,然后pip freeze > requirements.txt存储所需的所有软件包的列表。

This approach (having all dependencies in a directory and not downloading from an index) only works when the directory contains all packages. The directory should therefore contain all dependencies but also all packages that those dependencies depend on (e.g., six, pytz etc).

You should therefore manually include these in requirements.txt (so that the first step downloads them explicitly) or you should install all packages using PyPI and then pip freeze > requirements.txt to store the list of all packages needed.


回答 1

我已经安装了python3,但是/ usr / bin / python中的python仍然是旧的2.7版本

这个工作(<pkg>pyserial在我的情况):

python3 -m pip install <pkg>

I had installed python3 but my python in /usr/bin/python was still the old 2.7 version

This worked (<pkg> was pyserial in my case):

python3 -m pip install <pkg>

回答 2

经过2个小时的搜索,我找到了一种只需一行命令即可修复它的方法。您需要知道软件包的版本(只需搜索PACKAGE版本)。

命令:

python3 -m pip install --pre --upgrade PACKAGE==VERSION.VERSION.VERSION

After 2 hours of searching, I found a way to fix it with just one line of command. You need to know the version of the package (Just search up PACKAGE version).

Command:

python3 -m pip install --pre --upgrade PACKAGE==VERSION.VERSION.VERSION

回答 3

下面的命令为我工作-

python -m pip install flask

Below command worked for me –

python -m pip install flask

回答 4

尝试使用以下命令通过Powershell安装flask。

pip install --isolated Flask

这将允许安装以避免环境变量和用户配置。

Try installing flask through the powershell using the following command.

pip install --isolated Flask

This will allow installation to avoide environment variables and user configuration.


回答 5

并非总是如此,但是在某些情况下,该软件包已经存在。例如-getpass。它未在“点列表”中列出,但可以导入和使用:

在此处输入图片说明

如果我尝试通过pip install getpass进行安装,则会出现以下错误:“找不到满足要求getpass的版本”

Not always, but in some cases the package already exists. For example – getpass. It is not listed by “pip list” but it can be imported and used:

enter image description here

If I try to pip install getpass I get the following error: “Could not find a version that satisfies the requirement getpass”


回答 6

awscli在Windows 10上的anaconda(python 3.7)中安装时出现此错误。在进行故障排除时,我转到了答案https://stackoverflow.com/a/49991357/6862405,然后转到https://stackoverflow.com/a/54582701/6862405。最后发现,我需要安装库PyOpenSSLcryptographyenum34idnaipaddress。安装完这些(使用简单pip install命令)之后,我就可以安装了awscli

I got this error while installing awscli on Windows 10 in anaconda (python 3.7). While troubleshooting, I went to the answer https://stackoverflow.com/a/49991357/6862405 and then to https://stackoverflow.com/a/54582701/6862405. Finally found that I need to install the libraries PyOpenSSL, cryptography, enum34, idna and ipaddress. After installing these (using simply pip install command), I was able to install awscli.


回答 7

如果您在工作场所遇到此问题。这可能是您的解决方案。

pip install -U <package_name> --user --proxy=<your proxy>

If you facing this issue at the workplace. This might be the solution for you.

pip install -U <package_name> --user --proxy=<your proxy>

回答 8

只需遵循项目页面上列出的要求即可:https : //pypi.org/project/pgmagick/

Just follow the requirements listed on the project’s page: https://pypi.org/project/pgmagick/


回答 9

使用命令提示符,然后选择以管理员身份运行。

升级点子版本

要升级PIP,请键入以下命令,然后按Enter:

python.exe -m pip安装–upgrade pip

返回python路径C:\ Users \ Jack \ AppData \ Local \ Programs \ Python \ Python37 \ Scripts

类型jupyter笔记本

您将被重定向到http:// localhost:8888 / undefined / tree -Jupyter主页

希望能帮助到你 !!!!!!!!!!!

Use Command Prompt, and then select Run as administrator.

Upgrade the pip version

To upgrade PIP, type this command, and then press Enter:-

python.exe -m pip install –upgrade pip

Go Back to python path C:\Users\Jack\AppData\Local\Programs\Python\Python37\Scripts

Type jupyter notebook

You will be redirected to http://localhost:8888/undefined/tree – Jupyter Home Page

Hope it helps !!!!!!!!!!!


回答 10

可能有帮助

sudo pip install wheel == 0.29.0

might help

sudo pip install wheel==0.29.0


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。