2

I want to install python packages on OS X El Capitan. I saw the SIP was enabled to I disabled it. To make all the changes I want to. I deleted Scipy and Numpy that were installed in:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/

I installed Scipy using the following command:

sudo pip install --user scipy

It still installs it in under:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/

I want all my python packages to go under:

/Library/Python/2.7/site-packages/

I even tried this:(didnt work)

pip install --install-option="--prefix=$/Library/Python/2.7/site-packages/" --ignore-installed scipy

So things I want to do:

  • Make some config changes so that all my python packages get installed under: /Library/Python/2.7/site-packages/

  • Force python to search for packages first under : /Library/Python/2.7/site-packages/

  • Also python seems to be picking up setuptools (old version) installed under: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/

    I want it to use the new version installed under: /Library/Python/2.7/site-packages/.

  • So after all these changes every package I update pip updates the on under: /Library/Python/2.7/site-packages/.

My PYTHONPATH in my .bash_profile is set to /Library/Python/2.7/site-packages

Community
  • 1
  • 1
cryp
  • 2,285
  • 3
  • 26
  • 33
  • Why do all this? Install `brew` and you dont ever have to worry about getting into issues with overriding system packages.. EVER! – Javier Buzzi Dec 12 '15 at 15:22
  • I have brew. You mean install python using brew and the use pip to install packages ? – cryp Dec 12 '15 at 15:27
  • Yup. Try REALLY hard never to use/touch system packages, install your own version of python (using brew) and i would advice not to install anything in there either other than `virtualenv`. Then in your project use `virtualenv`/ `pyvenv` (py3.x) to install a standalone version and there INSTALL everything you want. – Javier Buzzi Dec 12 '15 at 15:29
  • 1
    Backstory: The reason you do this is for compatibility, right now you only have one project, but when you have 3-10 with different package requirements for all, it becomes a LIVING HELL, one want `package-a` v1.2 while another wants `package-a` v2.3 .. what do you do? Simple! If you have all your projects separate no one will care what packages your 2nd project wants. This bit me in the butt a lot when i first started, dont be like me, do things right the first time around :P – Javier Buzzi Dec 12 '15 at 15:33
  • aah ok ! I'll do that thanks ! – cryp Dec 12 '15 at 15:34
  • 1
    Rule of thumb, by the way: if you have to do `sudo pip install ...` you're doing it wrong. There are "some" exceptions, but for right now, avoid it like the plague. – Javier Buzzi Dec 12 '15 at 15:37
  • Please read related answer http://stackoverflow.com/questions/33004708/osx-el-capitan-sudo-pip-install-oserror-errno-1-operation-not-permitted/33004920#33004920 – Mikko Ohtamaa Dec 12 '15 at 16:34

0 Answers0