本文首发于我的个人博客:尾尾部落

在阿里云服务器上,用virtualenv创建虚拟环境时,报了个错误

root@iZwz982qla1uxm1s5dnyo7Z:/usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info# virtualenv -p python3 venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python2
Not overwriting existing python script /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python (you must use /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python2)
Please make sure you remove any previous custom paths from your /root/.pydistutils.cfg file.1 [global]
Installing setuptools, pkg_resources, pip, wheel...Complete output from command /usr/lib/python3/dis...nfo/venv/bin/python2 - setuptools pkg_resources pip wheel:Collecting setuptoolsDownloading http://mirrors.aliyun.com/pypi/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
Collecting pkg_resources
Exception:
Traceback (most recent call last):File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in mainstatus = self.run(options, args)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 328, in runwb.build(autobuilding=True)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 748, in buildself.requirement_set.prepare_files(self.finder)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 360, in prepare_filesignore_dependencies=self.ignore_dependencies))File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 512, in _prepare_filefinder, self.upgrade, require_hashes)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 273, in populate_linkself.link = finder.find_requirement(self, upgrade)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 442, in find_requirementall_candidates = self.find_all_candidates(req.name)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 400, in find_all_candidatesfor page in self._get_pages(url_locations, project_name):File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 545, in _get_pagespage = self._get_page(location)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 648, in _get_pagereturn HTMLPage.get_page(link, session=self.session)File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 760, in get_pageresp.raise_for_status()File "/usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py", line 840, in raise_for_statusraise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: http://mirrors.aliyun.com/pypi/simple/pkg-resources/
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module>main()File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in mainsymlink=options.symlink)File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environmentdownload=download,File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheelcall_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess% (cmd_desc, proc.returncode))
OSError: Command /usr/lib/python3/dis...nfo/venv/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2

看到HTTPError: 404 Client Error: Not Found for url: http://mirrors.aliyun.com/pypi/simple/pkg-resources/以为是阿里云的安全组配置没配好,折腾了半天,原来是访问PyPI镜像源出了问题,将pip的默认的源地址改为国内源即可。具体操作如下:

vim ~/.pip/pip.conf打开pip配置文件:
写入

[global]
index-url = http://e.pypi.python.org/simple

以下这几个国内源都可以
e.pypi.python.org
pypi.douban.com
pypi.hustunique.com

virtualenv -p python3 venv报错相关推荐

  1. python操作html的object_关于pycharm 切换 python3.9 报错 ‘HTMLParser‘ object has no attribute ‘unescape‘ 的问题...

    有的bug,莫名其妙就好了- python3.9 报错 "AttributeError: 'HTMLParser' object has no attribute 'unescape'&qu ...

  2. python3运行报错:TypeError: Object of type ‘type‘ is not JSON serializable解决方法(详细)

    python3运行报错:TypeError: Object of type 'type' is not JSON serializable解决方法(详细) 参考文章: (1)python3运行报错:T ...

  3. Python3.5 报错:NameError: name 'reload' is not defined

    python3.5 在调用自己编写的regTrees.py文件时,直接reload(regTrees)发生错误. 报错:NameError: name 'reload' is not defined ...

  4. 安装python3.6报错_CentOS 7下安装Python3.6 及遇到的问题小结

    先给大家介绍下CentOS 7下安装Python3.6 的方法 安装python3.6可能使用的依赖 yum install openssl-devel bzip2-devel expat-devel ...

  5. ubuntu服务器python3.6报错ModuleNotFoundError: No module named '_bz2'

    之前没出现过这种问题,这次import pandas突然报错,查看了网上的一些方法之后决定下载了_bz2.cpython-36m-x86_64-linux-gnu.so   链接https://pan ...

  6. 完美解决:Python3.10报错 No module named ‘_ssl‘

    报错详情: 操作系统为centos7,python版本为3.10.7,openssl版本为3.0.5,运行gunicorn报No module named '_ssl' ModuleNotFoundE ...

  7. 安装python3出现报错信息:configure:error:cannot run C complied programs

    安装python3 执行 ./configure --prefix=/root/training/Pyhon-3.8.3 报错:configure:error:cannot run C complie ...

  8. CentOS下安装Python3.7报错ModuleNotFoundError: No module named '_ctypes'的解决方案

    问题复现: 编译安装Python3.7版本,在make install的时候,出现报错 zipimport.ZipImportError: can't decompress data; zlib no ...

  9. turtle安装以及python3安装报错解决方案,用python画小猪佩奇

    前言 turtle(海龟库)是python的一个绘制图像的函数库,它就像海龟一样,给定指令和坐标,在画布坐标系中一步一步绘制出你想要的图形,比如小猪佩奇.哆啦A梦.皮卡丘等.             ...

  10. python3 aes 报错 ValueError: Incorrect AES key length (95 bytes)的解决方案

    解决方案, 1.key的长度一定要是 16 的倍数 而且不能超长, 2.如果是自己随机出来的key 不是16的倍数,加密时不影响,但是在解密时,用 b'\x00' 补齐16的倍数 具体分析如下: 错误 ...

最新文章

  1. wukong引擎源码分析之索引——part 1 倒排列表本质是有序数组存储
  2. 设计模式(十)享元模式Flyweight(结构型)
  3. 操作ROS松灵机器人步骤及遇到的问题
  4. DFF之--(一)神经网络入门之线性回归
  5. PHP 发送HTTP post请求发送和获取
  6. 下周见!Redmi K50标准版配置细节曝光:骁龙870+67W快充
  7. django-区分时区的时间类型
  8. Atitit.eclise的ide特性-------abt 编译
  9. 全面剖析雅虎助手以及网络实名的流氓行径(9)
  10. 如何打印身份证的正反面
  11. C++程序设计语言学习笔记:异常处理
  12. UiBot 网页数据抓取
  13. X86汇编语言经典资料,初学者必看(转)
  14. mybase6.0.4的license key的生成方法
  15. 乐Pro3 乐视X720/乐视X722通刷官方线刷包_救砖包_解账户锁
  16. 设有n个人围坐一圈并按顺时针方向从1到n编号
  17. 微信小程序分享二维码生成
  18. 微信小程序项目实战:快递查询-李宁-专题视频课程
  19. shell while true
  20. Mysql中的flush privileges语句

热门文章

  1. 【转】mysql数据库优化大全
  2. for each in for in for of
  3. 实现Canvas2D绘图 使元素绕中心居中旋转
  4. Python阶段总结
  5. 日留存、周留存、月留存,究竟怎样才能让更多的用户留下来?
  6. 比较List和ArrayList的性能及ArrayList和LinkedList优缺点
  7. 2016年6月份那些最实用的 jQuery 插件专辑
  8. 在PHP中开启CURL扩展,使其支持curl()函数
  9. iOS Xcode 调试 Unable to fix code signing issue
  10. 【OPPO主题制作系列 - 01】-- 写个小工具自动打包Theme文件