HomeBrew Mac更改Python路径 [英] HomeBrew Mac change Python Path

查看:231
本文介绍了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

这篇关于HomeBrew Mac更改Python路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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