我正在使用 Ubuntu 14.4 LTS 实例在 ec2 上设置一个 django 项目。我想使用 python 3 和 django 编写我的代码。我被告知最好的方法是使用 virtualenvwrapper。我试过:
ubuntu:~$ sudo pip3 install virtualenvwrapper
Successfully uninstalled six
Successfully installed virtualenvwrapper virtualenv virtualenv-clone stevedore argparse pbr six
Cleaning up...
ubuntu:~$ mkvirtualenv env1
mkvirtualenv: command not found
我做错了什么?
编辑:
我按照您的指示,注销并重新登录:
/usr/bin/python: No module named virtualenvwrapper
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/bin/python and that PATH is
set properly.
我怀疑这是因为我正在安装到 python3,它不是默认的 python 解释器
最佳答案
Shell Startup File
Add three lines to your shell startup file (
.bashrc
,.profile
, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/Devel source /usr/local/bin/virtualenvwrapper.sh
特别是,采购上面的 shell 脚本将允许您运行所有 virtualenvwrapper 命令。
关于python - 尝试使用 pip3 安装 virtualenvwrapper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28772740/