找不到Pip套件-Brewed Python [英] Pip packages not found - Brewed Python

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

问题描述

在Mac上运行随HomeBrew一起安装的Python 2.7.3.

Running Python 2.7.3, installed with HomeBrew, on a mac.

使用PIP安装了多个软件包,包括virtualenv. (以virtualenv为例,但没有一个程序包有效.)

Installed several packages using PIP, including virtualenv. (Using virtualenv as an example, but NONE of the packages work.)

当我尝试在终端中运行它们时,失败如下:

When I try to run them in terminal, it fails as follows:

$ virtualenv venv --distribute
-bash: virtualenv: command not found

或者:

$ python virtualenv.py venv
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'virtualenv.py': [Errno 2] No such file or directory

其他几点可能会有所帮助:

A few other points that may help:

$ which python
/usr/local/bin/python
$ pip freeze
MySQL-python==1.2.4
...
virtualenv==1.8.4
$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
$ echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages:

默认情况下,$ PYTHONPATH为空白,我在.bash_profile中进行了更改(无济于事). VirtualEnv确实存在于该路径中. 我还尝试将此路径添加到.profile $ path中,但这也无济于事,所以我将其删除.

By default, the $PYTHONPATH was blank, I changed it in .bash_profile (didn't help). VirtualEnv does exist at that path. I also tried adding this path to the .profile $path, but that didn't help either, so I removed it.

HomeBrew Python页面上,这似乎有些相关,但我是新来的到Python,却无法解决.已经花了几个小时的DuckDuckGoing了,却一无所获.

On the HomeBrew Python page it seems to somewhat relate to this, but I am new to Python, and can't figure it out. Have spent some hours DuckDuckGo'ing with nothing gained.

任何帮助将不胜感激.

已更新以反映实际使用情况.

Updated to reflect actual usage.

推荐答案

问题是我没有将Python添加到系统$ PATH中.

The problem was that I had not added Python to the system $PATH.

在brew安装结束时,它说(可通过键入brew info python进行查看):

At the end of the brew install it says (viewable by typing brew info python):

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.

因此,只需打开.profile并将其粘贴到其中,所有包都可以工作.

So, simply had to open .profile and paste it in, and all packages work.

非常感谢Brew IRC频道上的MistyM指出这一点!

Much thanks to MistyM on the Brew IRC channel for pointing that out!

这篇关于找不到Pip套件-Brewed Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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