赞
踩
命令:pip3 install -
i https:
/
/
pypi.douban.com
/simple virtualenvwrapper
有些小伙伴安装virtualenvwrapper时可能会出现报错:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
- ERROR: Command errored out with exit status 1:
- command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lna_rq3y/virtualenvwrapper/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lna_rq3y/virtualenvwrapper/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ldlw2k__
- cwd: /tmp/pip-install-lna_rq3y/virtualenvwrapper/
- Complete output (34 lines):
- WARNING: The wheel package is not available.
- WARNING: The repository located at mirrors.cloud.aliyuncs.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.cloud.aliyuncs.com'.
- ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
- ERROR: No matching distribution found for pbr
- Traceback (most recent call last):
- File "/usr/local/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
- subprocess.check_call(cmd)
- File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
- raise CalledProcessError(retcode, cmd)
- subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpjjhoqpjz', '--quiet', '--index-url', 'http://mirrors.cloud.aliyuncs.com/pypi/simple/', 'pbr']' returned non-zero exit status 1.
-
- During handling of the above exception, another exception occurred:
- 省略......

解决方案及步骤:
1. 升级pip: sudo pip install --upgrade pip
2. 升级setuptools: sudo pip install --upgrade setuptools
3. 安装pbr扩展包:
sudo pip install pbr -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install --no-deps stevedore -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install virtualenvwrapper -i https://pypi.tuna.tsinghua.edu.cn/simple
OK,以上步骤完成后,再次执行安装虚拟环境命令。
.bashrc位置:一般在根目录下,操作 ls -a 命令可以查看到 ,如果没有找到请操作:find / -name .bashrc
执行:sudo vim vim ~/.bashrc
进入编辑模式,将以下内容复制 fi 后面
- # 虚拟环境配置
- export WORKON_HOME=~/Envs #设置virtualenv的统一管理目录
- export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' #添加virtualenvwrapper的参数,生成干净隔绝的环境
- export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 #指定成自己的python解释器
- source /usr/local/bin/virtualenvwrapper.sh # 指定成自己的执行virtualenvwrapper安装脚本
然后重启系统,就可以正常操作了
mkvirtualenv 名字:创建虚拟环境
workon 名字:进入或切换虚拟环境
rmvirtualenv 名字:删除虚拟环境
lsvirtualenv:列举所有虚拟环境
deactivate:退出虚拟环境
谢谢大家支持!如能有用,请记得收藏哦!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。