找不到Virtualenv命令 [英] Virtualenv Command Not Found

查看:927
本文介绍了找不到Virtualenv命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管进行了种种尝试,我仍然无法使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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆