All*_*ітy 17 python bash virtualenv virtualenvwrapper 16.04
在 16.04 的全新安装中,我尝试按照Gerhard Burger 的这个很棒的答案来安装 virtualenvwrapper 。
配置好后.bashrc,每次打开终端都会显示
bash: /usr/local/bin/python2.7: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7 and that PATH is
set properly.
Run Code Online (Sandbox Code Playgroud)
脚本位置是,
$ sudo find / -name virtualenvwrapper.sh
[sudo] password for john:
/usr/local/bin/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)
我的内容.bashrc是,
export WORKON_HOME=/home/john/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=/home/john/.virtualenvs
Run Code Online (Sandbox Code Playgroud)
这是我的 pip freeze
cffi==1.5.2
greenlet==0.4.9
pbr==1.10.0
readline==6.2.4.1
six==1.10.0
stevedore==1.15.0
virtualenv==15.0.2
virtualenv-clone==0.2.6
virtualenvwrapper==4.7.1
Run Code Online (Sandbox Code Playgroud)
python解释器的位置,
$ which python
/usr/bin/python
Run Code Online (Sandbox Code Playgroud)
我如何使它工作?
谢谢你。
小智 32
我使用的是 Ubuntu 服务器 16.04,您还应该导出安装了 virtualenvwrapper 的 python 解释器
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=~/.virtualenvs
source /home/vagrant/.local/bin/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)
确保根据您自己的系统替换上述所有路径。例如,您的包装器脚本可能位于/usr/local/bin/virtualenvwrapper.sh,或者您可能使用不同的解释器或 virtualenvs home,...
您可能需要更新 PYTHONPATH 环境变量。在 .bashrc 中的所有 virtualenvwrapper 变量之前,添加以下行:
export PYTHONPATH=${PYTHONPATH}:/usr/bin
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29720 次 |
| 最近记录: |