I had pip installed and installed few packages successfuly with it. However after running the following commands. I get an error saying no module named pip:
sudo chmod 666 /Library/Python/2.7/site-packages/
pip install --upgrade git+http://[email protected]/sympy/sympy.git
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
Best How To :
Err... why did you run that chmod?
The issue here is that 666 is bad for directories. The permission bits, specifically the executable bit, has a different meaning for directories: in order to go into a directory, you need it to have the executable bit set. See, for example, this question or this one. Try running
cd /Library/Python/2.7/site-packages/, and you'll see the problem.
So while you were trying to make the directory read-write for everyone, you actually made it so that no one can access it.
chmod +X /Library/Python/2.7/site-packages/ will fix this: the +X permission sets the executable bit only on directories (and files that already have +x).
Beyond this, however, do you really want something in /Library to be read-write for everyone? And have you considered (from the directory structure I'm assuming OS X) using something other than the Apple-provided Python, which often has problems with package installation, etc? I personally use the Homebrew version.