gpt4 book ai didi

python - pip3 失败,但 pip 在 vi​​rtualenv 上工作正常

转载 作者:行者123 更新时间:2023-12-01 04:18:23 32 4
gpt4 key购买 nike

我想为 python3 安装 virtualenv。在过去的一个小时里我一直在试图解决这个问题,但没有成功。

root@XXXX:~# pip3 install virtualenv
Downloading/unpacking virtualenv
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement virtualenv
Cleaning up...
No distributions at all found for virtualenv
Storing debug log for failure in /root/.pip/pip.log
root@XXXX:~# vim /root/.pip/pip.log
root@XXXX:~# pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-13.1.2-py2.py3-none-any.whl (1.7MB): 1.7MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...

如您所见,pip 工作正常,但 pip3 超时。

根据失败的 pip.log 输出,pip3 尝试向 pypi 请求超时:

/usr/bin/pip3 run on Wed Dec  2 08:45:51 2015
Downloading/unpacking virtualenv
Getting page https://pypi.python.org/simple/virtualenv/
Could not fetch URL https://pypi.python.org/simple/virtualenv/: timed out
Will skip URL https://pypi.python.org/simple/virtualenv/ when looking for download links for virtualenv
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: timed out
Will skip URL https://pypi.python.org/simple/ when looking for download links for virtualenv
Cannot fetch index base URL https://pypi.python.org/simple/
URLs to search for versions for virtualenv:
* https://pypi.python.org/simple/virtualenv/
Getting page https://pypi.python.org/simple/virtualenv/
Could not fetch URL https://pypi.python.org/simple/virtualenv/: timed out
Will skip URL https://pypi.python.org/simple/virtualenv/ when looking for download links for virtualenv
Could not find any downloads that satisfy the requirement virtualenv
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
No distributions at all found for virtualenv
Exception information:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1178, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python3/dist-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 virtualenv

关于如何解决这个问题的任何提示都会很棒。提前致谢。

最佳答案

pip3没有virtualenv,但是很容易设置一个新环境来使用python3

  1. 您可以使用普通的 pip 安装它

pip install virtualenv

  • 配置新的 virtualenv 以使用 python3
  • virtualenv -p python3 环境名称

    关于python - pip3 失败,但 pip 在 vi​​rtualenv 上工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34038329/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com