问题
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
回答1:
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
回答2:
Since you installed PyQt by using Homebrew, you should also use Homebrew Python 2.
To install it, run: brew install python
Now, you can import PyQt normally.
来源:https://stackoverflow.com/questions/17033096/homebrew-mac-change-python-path