找不到 Virtualenv 命令 [英] Virtualenv Command Not Found
问题描述
尽管进行了各种尝试,我还是无法让 virtualenv
工作.我在 MAC OS X 上安装了 virtualenv
使用:
I couldn't get virtualenv
to work despite various attempts. I installed virtualenv
on MAC OS X using:
pip install virtualenv
并且还将 PATH
添加到我的 .bash_profile
中.每次我尝试运行 virtualenv
命令时,它都会返回:
and have also added the PATH
into my .bash_profile
. Every time I try to run the virtualenv
command, it returns:
-bash: virtualenv: command not found
每次我运行 pip install virtualenv
时,它都会返回:
Every time I run pip install virtualenv
, it returns:
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
我知道在 mac 中,virtualenv
应该正确安装在
I understand that in mac, the virtualenv
should be correctly installed in
/usr/local/bin
virtualenv
确实安装在 /usr/local/bin
中,但是每当我尝试运行 virtualenv
命令时,命令是未找到.我还尝试在目录 /usr/local/bin
中运行 virtualenv
命令,它给了我相同的结果:
The virtualenv
is indeed installed in /usr/local/bin
, but whenever I try to run the virtualenv
command, the command is not found. I've also tried to run the virtualenv
command in the directory /usr/local/bin
, and it gives me the same result:
-bash: virtualenv: command not found
这些是我添加到我的 .bash_profile 中的路径
These are the PATHs I added to my .bash_profile
export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/usr/local/bin/python
export PATH=$PATH:/Library/Framework/Python.framework/Version/2.7/lib/site-packages
有什么解决方法吗?为什么会这样?
Any workarounds for this? Why is this the case?
推荐答案
如果你安装了
pip install virtualenv
你需要运行
sudo /usr/bin/easy_install virtualenv
将它放在 /usr/local/bin/
中.
上述目录默认应该在你的PATH
中;否则,相应地编辑您的 .zshrc
(或 .bashrc
).
The above directory by default should be in your PATH
; otherwise, edit your .zshrc
(or .bashrc
) accordingly.
这篇关于找不到 Virtualenv 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!