Mac Python Setuptools Installing in Wrong Directory

↘锁芯ラ 提交于 2019-12-22 01:29:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!