Python 找不到满足要求的版本 <package>
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32302379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find a version that satisfies the requirement <package>
提问by Gabriel
I'm installing several Python packages in Ubuntu 12.04 using the following requirements.txt
file:
我正在使用以下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
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.
然后pip install
再次运行第二个命令。
But that only works for thatparticular package. When I run the second pip install
command again, the process is stopped now complaining about anotherrequired 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.
但这仅适用于该特定包。当我pip install
再次运行第二个命令时,该进程现在停止,抱怨另一个必需的包,我需要再次重复该过程,即:手动安装新的必需包(使用上面的命令),然后运行第二个pip install
命令。
So far I've had to manually install six
, pytz
, nose
, and now it's complaining about needing mock
.
到目前为止,我不得不手动安装six
, pytz
, nose
,现在它抱怨需要mock
.
Is there a way to tell pip
to automatically install allneeded dependencies so I don't have to do it manually one by one?
有没有办法告诉pip
自动安装所有需要的依赖项,这样我就不必一一手动安装?
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.
添加:这只发生在 Ubuntu 12.04 BTW 中。在 Ubuntu 14.04 中,pip install
应用于requirements.txt
文件的命令没有问题。
采纳答案by Simeon Visser
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).
这种方法(在目录中包含所有依赖项而不是从索引下载)仅在目录包含所有包时才有效。因此,该目录应包含所有依赖项以及这些依赖项所依赖的所有包(例如six
,pytz
等)。
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.
因此,您应该手动包含这些requirements.txt
(以便第一步明确下载它们),或者您应该使用 PyPI 安装所有包,然后pip freeze > requirements.txt
存储所需的所有包的列表。
回答by user3782287
Try installing flask through the powershell using the following command.
尝试使用以下命令通过 powershell 安装烧瓶。
pip install --isolated Flask
This will allow installation to avoide environment variables and user configuration.
这将允许安装避免环境变量和用户配置。
回答by Trisha
回答by Jagd_Panzer_E100
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).
经过 2 个小时的搜索,我找到了一种只需一行命令即可修复它的方法。您需要知道包的版本(只需搜索 PACKAGE 版本)。
Command:
命令:
python3 -m pip install --pre --upgrade PACKAGE==VERSION.VERSION.VERSION
回答by svinec
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:
并非总是如此,但在某些情况下,该包已经存在。例如 - getpass。它没有被“pip list”列出,但可以导入和使用:
If I try to pip install getpass I get the following error: "Could not find a version that satisfies the requirement getpass"
如果我尝试 pip install getpass,我会收到以下错误:“找不到满足 getpass 要求的版本”
回答by maw
I had installed python3 but my python in /usr/bin/python was still the old 2.7 version
我已经安装了 python3 但我在 /usr/bin/python 中的 python 仍然是旧的 2.7 版本
This worked (<pkg>
was pyserial
in my case):
这有效(<pkg>
就pyserial
我而言):
python3 -m pip install <pkg>
回答by arup.dutta22
Use Command Prompt, and then select Run as administrator.
使用命令提示符,然后选择以管理员身份运行。
Upgrade the pip version
升级pip版本
To upgrade PIP, type this command, and then press Enter:-
要升级 PIP,请键入此命令,然后按 Enter:-
python.exe -m pip install --upgrade pip
python.exe -m pip install --upgrade pip
Go Back to python path C:\Users\Hyman\AppData\Local\Programs\Python\Python37\Scripts
回到 python 路径 C:\Users\Hyman\AppData\Local\Programs\Python\Python37\Scripts
Type jupyter notebook
输入 jupyter 笔记本
You will be redirected to http://localhost:8888/undefined/tree- Jupyter Home Page
您将被重定向到http://localhost:8888/undefined/tree- Jupyter 主页
Hope it helps !!!!!!!!!!!
希望能帮助到你 !!!!!!!!!!!
回答by Freelancer
Below command worked for me -
以下命令对我有用-
python -m pip install flask
回答by Ray Kim
Just follow the requirements listed on the project's page: https://pypi.org/project/pgmagick/
只需遵循项目页面上列出的要求:https: //pypi.org/project/pgmagick/
回答by Ankit Seth
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/6862405and 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
.
我awscli
在 anaconda (python 3.7) 中的 Windows 10 上安装时遇到此错误。在进行故障排除时,我转到了答案https://stackoverflow.com/a/49991357/6862405,然后转到了https://stackoverflow.com/a/54582701/6862405。最后发现,我需要安装库PyOpenSSL
,cryptography
,enum34
,idna
和ipaddress
。安装这些(使用简单的pip install
命令)后,我能够安装awscli
.