无法安装Python的包'请求'

jba*_*037 2 python django ubuntu pip python-requests

我尝试使用以下命令在我的Ubuntu 10.04服务器上安装python请求包:

$ pip install requests
Run Code Online (Sandbox Code Playgroud)

但我一直得到回报:

下载/解压缩请求无法获取URL http://pypi.python.org/simple/requests:在查找请求的下载链接时将跳过URL(... url ...)无法获取URL(... url ...):在查找请求的下载链接时会跳过URL(... url ...)无法获取索引基URL(... url ...)无法找到需求请求,也无法获取索引URL(.. .url ...)存储完整的登录./pip-log.txt

请原谅我使用上面的"(... url ...)",因为StackOverflow不允许我发布超过2个链接.

这是pip-log.txt中的回溯:

Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
File "/usr/lib/python2.6/dist-packages/pip.py", line 08, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
File "/usr/lib/python2.6/dist-packages/pip.py", line 1750, in install_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.6/dist-packages/pip.py", line 996, in find_requirement
    url_name = self._find_url_name(Link(self.index_urls[0]), url_name, req)
File "/usr/lib/python2.6/dist-packages/pip.py", line 1073, in _find_url_name
    raise DistributionNotFound('Cannot find requirement %s, nor fetch index URL %s' % (req, index_url))
DistributionNotFound: Cannot find requirement requests, nor fetch index URL (...url...)
Run Code Online (Sandbox Code Playgroud)

我知道pip工作正常,因为我已经通过它安装了许多其他软件包.我也尝试使用easy_install和源代码安装,但两者都有相同的问题.我是Python/Django的新手,任何人都可以帮我指出问题的正确方向吗?

sin*_*ger 6

你可以尝试:

  1. 使用像这里解释的镜像当PyPI失效时怎么办

    pip install --use-mirrors $PACKAGE
    
    Run Code Online (Sandbox Code Playgroud)
  2. 正如@ sigmavirus24推荐的那样,第二种选择就是使用 Base URL of Python Package Index

    pip install -i https://crate.io requests 
    
    Run Code Online (Sandbox Code Playgroud)
  3. 直接从git安装包源

    pip install -e git+https://github.com/kennethreitz/requests#egg=requests
    
    Run Code Online (Sandbox Code Playgroud)

尝试1 - 有时我遇到相同的问题,因为我的互联网连接不好或者pip已关闭.