I ran into some issues using pip on my mac, and uninstalled it altogether.
Now when I try to reinstall it, running $sudo easy_install pip
I get:
TEST FAILED: /lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/lib/python2.7/site-packages/
and your PYTHONPATH environment variable currently contains:
''
[this pasted output cut short for brevity]
I've tried adding the directory listed (/lib/python2.7/site-packages/) into my pythonpath using both ./profile and ./bash_profile, but neither affect the sys.path variable when I run python, which includes only
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
Is my problem that I have two versions of python installed (under the two directories listed)?
Or is it my pythonpath is screwed up in a way that I've been unable to remedy?
Edit:
$ which python
returns /usr/bin/python
and $ which easy_install
returns /usr/bin/easy_install
I figured it out.
When I tried to install python2 via brew, then ran brew doctor
I got the following warning.
Warning: A .pydistutils.cfg file was found in $HOME, which may cause Python
builds to fail. See:
https://bugs.python.org/issue6138
https://bugs.python.org/issue4655
Sure enough, when I deleted .pydistutils.cfg the problem cleared up.
FWIW, here's the SO question that got me to create the file to begin with:
Combine --user with --prefix error with setup.py install
(The answer there does mention it may cause unintended consequences. I just figure that linking to it may help search visibility for anyone who currently has the same problem that I had, but has forgotten that they created that file.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With