HomeBrew Mac更改Python路径

问题描述:

我正在尝试安装PyQT,并且使用了PyQT.是已经使用家用Brew安装的.但是当我尝试导入它时,python不能.我在Home brew中收到以下警告.我是Mac的新手,无法弄清楚如何更改python路径.任何帮助都会很棒.

I am trying to install PyQT and I used PyQT. Is has been installed using home brew. But When I try to import it, python can't. I get the following warning in Home brew. I am new to Mac and can't figure out how to change the python path. Any help would be great.

对于非自制Python(2.x),您需要像这样修改PYTHONPATH: 导出PYTHONPATH =/usr/local/lib/python2.7/site-packages:$ PYTHONPATH

For non-homebrew python (2.x), you need to amend your PYTHONPATH like so: export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

您应编辑~/.bash_profile(如果文件不存在,则创建文件)以设置PYTHONPATH环境变量:

You should edit ~/.bash_profile (create the file if it does not exist) to set the PYTHONPATH environment variable:

export PYTHONPATH=`brew --prefix`/lib/python2.7/site-packages:$PYTHONPATH