pip 不获取任何链接

0 投票
1 回答
752 浏览
提问于 2025-04-18 01:12

我刚刚从源代码安装了 Python 3.4,现在想用 pip 来下载一些包。但是每次我运行它,比如说:

pip install -v django

我都会遇到以下错误(和 /root/.pip/pip.log 中的输出一样):

/var/www/sova_move/newvenv/venv/bin/pip run on Thu Apr  3 18:16:44 2014
Downloading/unpacking django
  Getting page https://pypi.python.org/simple/django/
  Could not fetch URL https://pypi.python.org/simple/django/: connection error: [Errno 2] No such file or directory
  Will skip URL https://pypi.python.org/simple/django/ when looking for download links for django
  Getting page https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/: connection error: [Errno 2] No such file or directory
  Will skip URL https://pypi.python.org/simple/ when looking for download links for django
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for django:
  * https://pypi.python.org/simple/django/
  Getting page https://pypi.python.org/simple/django/
  Could not fetch URL https://pypi.python.org/simple/django/: connection error: [Errno 2] No such file or directory
  Will skip URL https://pypi.python.org/simple/django/ when looking for download links for django
  Could not find any downloads that satisfy the requirement django
Cleaning up...
  Removing temporary dir /var/www/sova_move/newvenv/venv/build...
No distributions at all found for django
Exception information:
Traceback (most recent call last):
  File "/var/www/sova_move/newvenv/venv/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/var/www/sova_move/newvenv/venv/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/var/www/sova_move/newvenv/venv/lib/python3.4/site-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/var/www/sova_move/newvenv/venv/lib/python3.4/site-packages/pip/index.py", line 277, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for django

我的网络连接没问题(我可以正常更新系统,ping 一下谷歌也没问题……),而且 https://pypi.python.org/simple/Django/ 这个地址肯定是存在的(我现在就能看到)。而且,我可以使用 pip list、pip search,当我手动用 wget 下载包后,再用

python setup.py install

也能正常工作,甚至还能下载依赖包。我没有使用代理。这是在 Raspberry Pi 上运行的,系统是 Arch Linux。我的网络连接是静态的。Python 运行得很好,pip 也已经安装(在 3.4 中是默认的)。

谢谢

1 个回答

0

我重新安装了我的虚拟环境,这次是用本地的Python版本,没有使用符号链接,现在一切都正常了。谢谢大家!

撰写回答