无法通过pip安装任何软件包 [英] Unable to install any package through pip

查看:245
本文介绍了无法通过pip安装任何软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

For some reason I have issues installing new packages with my pip. I have an OS Sierra environment and everything was working fine before. Now either I use a virtualenv or not, I get:

Collecting requests
Could not find a version that satisfies the requirement requests (from 
  versions: )
No matching distribution found for requests

这不仅适用于请求"库,还适用于所有其他库(例如django等).

This is not only for the "requests" library but also for all the others (e.g. django etc.).

我有最新的点子

 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

And my python version is: 2.7.12

此外,基于

Moreover based on this article I checked if I can curl the PyPi website and I do get a response back.

有什么想法吗?

已编辑

我以如下方式执行了pip安装:

I executed the pip install as:

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

推荐答案

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

Thanks to @Klaus D. comment (proposed to add: the -v flag in the command), I found out that the URL for:

  http://pypi.python.org/simple/requests/ 

需要更改为

  https://pypi.python.org/simple/requests/  (with SSL).

执行此命令可以正常工作:

Executing this command worked fine:

pip install -v requests -i https://pypi.python.org/simple/

或者,您也可以按照答案之一在此处中所述更改pip.conf文件:

Alternatively you can change the pip.conf file as described in one of the answers here:

[global]
timeout = 60
index-url = https://pypi.python.org/simple

这篇关于无法通过pip安装任何软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆