[英]Unable to install any package through pip
For some reason I have issues installing new packages with my pip.出于某种原因,我在使用 pip 安装新软件包时遇到问题。 I have an OS Sierra environment and everything was working fine before.我有一个 OS Sierra 环境,之前一切正常。 Now either I use a virtualenv or not, I get:现在无论我是否使用 virtualenv,我都会得到:
Collecting requests
Could not find a version that satisfies the requirement requests (from
versions: )
No matching distribution found for requests
This is not only for the "requests" library but also for all the others (eg django etc.).这不仅适用于“请求”库,还适用于所有其他库(例如 django 等)。
I have the latest pip:我有最新的点子:
pip --version
returns: pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
And my python version is: 2.7.12我的python版本是:2.7.12
Moreover based on this article I checked if I can curl the PyPi website and I do get a response back.此外,根据这篇文章,我检查了是否可以 curl PyPi 网站,并且确实得到了回复。
Any idea what is wrong?知道有什么问题吗?
EDITED已编辑
I executed the pip install as:我执行 pip install 为:
pip install -vvv requests
and I get a detailed output of the error:我得到了错误的详细输出:
Collecting requests
2 location(s) to search for versions of requests:
* http://pypi.python.org/simple/requests/
* http://pypi.wfp.org/simple/requests/
Getting page http://pypi.python.org/simple/requests/
Starting new HTTP connection (1): pypi.python.org
"GET /simple/requests/ HTTP/1.1" 403 16
Could not fetch URL http://pypi.python.org/simple/requests/: 403 Client
Error: SSL is required for url: http://pypi.python.org/simple/requests/ -
skipping
Getting page http://pypi.wfp.org/simple/requests/
Starting new HTTP connection (1): pypi.wfp.org
"GET /simple/requests/ HTTP/1.1" 404 None
Could not fetch URL http://pypi.wfp.org/simple/requests/: 404 Client
Error: NOT FOUND for url: http://pypi.wfp.org/simple/requests/ - skipping
Could not find a version that satisfies the requirement requests (from
versions: )
Cleaning up...
No matching distribution found for requests
Exception information:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/index.py",
line 514, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for requests
The solution proposed by user1919 helped me to resolve installation of tox on lxc ubuntu container as the defualt pip version 8 doesn't recognize the correct url user1919提出的解决方案帮助我解决了在lxc ubuntu容器上安装tox的问题,因为默认pip版本8无法识别正确的网址
I used: 我用了:
pip install -v tox -i https://pypi.python.org/simple/
....
....
....
Successfully installed filelock-3.0.10 pluggy-0.9.0 py-1.8.0 setuptools-40.8.0 toml-0.10.0 tox-3.7.0 virtualenv-16.4.3
Thanks to @Klaus D. comment (proposed to add: the -v flag in the command), I found out that the URL for: 感谢@Klaus D.注释(建议在命令中添加-v标志),我发现该URL为:
http://pypi.python.org/simple/requests/
needs to be changed to 需要更改为
https://pypi.python.org/simple/requests/ (with SSL).
Executing this command worked fine: 执行此命令可以正常工作:
pip install -v requests -i https://pypi.python.org/simple/
Alternatively you can change the pip.conf file as described in one of the answers here : 或者作为答案的一个描述你可以改变pip.conf文件在这里 :
[global]
timeout = 60
index-url = https://pypi.python.org/simple
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.