简体   繁体   中英

system default python can't use homebrew installed package

I have different versions of python installed on my mac. My system default python is ( $ which python ) "/Library/Frameworks/Python.framework/Versions/2.7/bin/python" .

And if I install something with pip command such as pip install numpy , the package will be installed in the system python's site-package "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages"

However, I want to setup ipython & Qt working environment. So I brew install pyqt , brew install PySide And these packages are installed in my home-brew python pack-control part. My home-brew python is in "/usr/local/lib/python2.7/site-packages" .

Now my python just can't import any Qt or PySide ... Any suggestions? How can I fix this?

Use the /usr/local/bin/python instead of the system installed python.

brew doctor should tell you that /usr/local/bin is not early enough in your path. By putting /usr/local/bin first (or earlier than /usr/bin) in your path, your shell will find homebrew versions of executables before system versions.

If you don't want to adjust your path, you can invoke which python you want to run. /usr/local/bin/python instead of just python at the shell prompt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM