问题
Prior to today, executing sudo python setup.py install would install my desired module to /Library/Python/2.7/site-packages/. However, today it has been trying to install to /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/.
The only installs that occurred between these changes were Macports, updating Command Line Tools for Xcode, and OS X El Capitan update.
How can I change the default setuptools install path back to /Library/Python/2.7/site-packages/?
UPDATE #1
$ which -a python
/usr/local/bin/python
/usr/bin/python
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
UPDATE #2
I just ran sudo /usr/bin/python setup.py install and it successfully installed my module into /Library/Python/2.7/site-packages/. Now I just need to figure out how to to make python default to /usr/bin/python.
UPDATE #3
python setup.py install directs to the correct location, but permission is denied. Thus, sudo python directs to /usr/local/Cellar/...
UPDATE #4
By changing the order of paths in /etc/paths, I can force sudo python to use /usr/bin/python before trying /usr/local/bin/python.
Thanks all!
来源:https://stackoverflow.com/questions/33302372/mac-python-setuptools-installing-in-wrong-directory