问题描述
我试图找出为什么我的 virtualenv
和/或 virtualenv
包装器 - 使用 pip
安装,使用 homebrew
- 找不到.我认为这是因为它没有添加到我的 PATH 中:
I am trying to find out why my virtualenv
and/or virtualenv
wrapper - installed using pip
using homebrew
- cannot be found. I think it's because it's not added to my PATH:
$ which virtualenv
$
和:
$ virtualenv someDir
$ -bash: virtualenv: command not found
我使用 homebrew
安装了 pip,使用 pip
安装了 virtualenv
,没有问题.我尝试重新安装 virtualenv
,但这也不起作用.我如何知道要添加到 PATH
的路径?只是 virtualenv.py
似乎安装到的路径?好像是:
I installed pip using homebrew
, and virtualenv
using pip
, without problems. I tried reinstalling virtualenv
, but that did not work either.How do I know what path to add to PATH
? Just the path that virtualenv.py
seems to be installed into? That seems to be:
/usr/local/lib/python2.7/site-packages/virtualenv.py
我还找到了本指南,其中暗示了这一点:
I also found this guide, which suggests this:
$ ln -s ../Cellar/python/2.7/Frameworks/Python.framework/Versions/2.7/bin/virtualenv virtualenv
然而,它并不能帮助我运行 virtualenv
.我使用的是 Mac OSX 10.7.5 (Lion).
However, it does not help me run virtualenv
. I am on Mac OSX 10.7.5 (Lion).
推荐答案
对于几乎所有简单"安装过程,我自己似乎是规则的例外.出于某种原因,这是一个与路径相关的问题:
It seems that I myself am the exception to the rule for almost all 'simple' installation procedures. For some reason, it WAS a path related issue:
我跑了brew info python
,输出了很多信息.在底部我发现了这个:
I ran brew info python
, which outputted a lot of information. At the bottom I found this:
Executable python scripts will be put in:
/usr/local/share/python
so you may want to put "/usr/local/share/python" in your PATH, too.
我将它添加到 /etc/launchd.conf
和 ~/.bashrc
中的 PATH 中,瞧:
I added that to my PATH in /etc/launchd.conf
and ~/.bashrc
and lo and behold:
$ which virtualenv
告诉我:
"/usr/local/share/python/virtualenv"
我仍然不知道为什么我无法在网上、任何地方找到任何指向正确方向的指示?pip install virtualenv
是否应该添加到 PATH 本身?如果是这样,为什么不在我的系统上?为什么@bibhas 明确告诉我这不是路径问题?
I still don't know why I couldn't find any pointers in the right direction, online, anywhere? Is pip install virtualenv
supposed to add to the PATH itself? If so, why not on my system? Why did @bibhas tell me explicitly it was not a path issue?
这篇关于如何将 virtualenv 添加到路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!