Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法通过pip安装任何软件包_Python_Pip - Fatal编程技术网

Python 无法通过pip安装任何软件包

Python 无法通过pip安装任何软件包,python,pip,Python,Pip,由于某些原因,我在安装新的pip包时遇到问题。我有一个OS Sierra环境,以前一切都很好。现在,无论我是否使用virtualenv,我都会得到: Collecting requests Could not find a version that satisfies the requirement requests (from versions: ) No matching distribution found for requests 这不仅适用于“请求”库,也适用于所有其他库(如d

由于某些原因,我在安装新的pip包时遇到问题。我有一个OS Sierra环境,以前一切都很好。现在,无论我是否使用virtualenv,我都会得到:

Collecting requests
Could not find a version that satisfies the requirement requests (from 
  versions: )
No matching distribution found for requests
这不仅适用于“请求”库,也适用于所有其他库(如django等)

我有最新的点子:

 pip --version
 returns: pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
我的python版本是:2.7.12

此外,我检查了我是否可以卷曲PyPi网站,我确实得到了回复

你知道怎么了吗

已编辑

我执行了pip安装,如下所示:

pip install -vvv requests
我得到了错误的详细输出:

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

感谢@klausd.comment(建议在命令中添加-v标志),我发现以下URL:

  http://pypi.python.org/simple/requests/ 
需要改成

  https://pypi.python.org/simple/requests/  (with SSL).
执行此命令效果良好:

pip install -v requests -i https://pypi.python.org/simple/
或者,您可以更改pip.conf文件,如其中一个答案中所述:


user1919提出的解决方案帮助我解决了在lxc ubuntu容器上安装tox的问题,因为defualt pip版本8无法识别正确的url

我用过:

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

在<代码>请求< /代码> doc网站上,写道:“Python 3的使用比Python 2更为可取。如果您在今天的生产中仍然使用Python 2,请考虑升级您的应用程序和基础结构。如果您使用Python 3,恭喜您——您确实是一个很有品味的人。- Kenneth Reitz。您是如何运行
pip
?@vinzee这一观点并不意味着
请求
与Python 2.7不兼容。@Klaus D.我一如既往地执行:pip安装请求您的HTTP似乎有问题。你在使用代理吗?您能否打开显示的URL(例如
http://pypi.python.org/simple/requests/
)是否在浏览器中?
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