Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HomeBrew Mac change Python Path

Tags:

macos

homebrew

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.

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

like image 564
Trying_hard Avatar asked Jun 10 '13 21:06

Trying_hard


People also ask

How do I set the path for brew on Mac?

Alternatively, you can also insert /usr/local/bin before the first line of /etc/paths to change the global default paths order, for all users and all major shells. An admin password will be required if you modify the file. If everything is good, you should see no warnings, and a message that you are "ready to brew!".

Where does Homebrew install Python on Mac?

For brewed Python, modules installed with pip or python3 setup.py install will be installed to the $(brew --prefix)/lib/pythonX. Y/site-packages directory (explained above).


1 Answers

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
like image 80
mipadi Avatar answered Sep 28 '22 14:09

mipadi