如何将virtualenv添加到路径 [英] How to add virtualenv to path

查看:483
本文介绍了如何将virtualenv添加到路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出为什么找不到我的virtualenv和/或virtualenv包装器-使用homebrew使用pip安装的包装器的原因.我认为是因为它没有添加到我的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添加到路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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