0

Every time I run pip install on my home laptop pip installs it in to /usr/local/lib/python2.7/site-packages folder. The same pip install command run on another Macbook and pip installs it into /Library/Python/2.7/site-packages folder asking for the root password and it is highly inconvenient.

Question: What needs to be done in order to configure the second laptop so pip installs the modules into the /usr/local/lib/python2.7/site-packages folder.

alphanumeric
  • 17,967
  • 64
  • 244
  • 392
  • 4
    Why can't you just use a virtualenv? – OneCricketeer Sep 07 '17 at 03:15
  • `/usr/local/lib/python2.7/site-packages` should also be protected against non-administrator writes... – ShadowRanger Sep 07 '17 at 03:16
  • Did you `brew install python` at some point? `/Library/Python/2.7` is the default, system Python – OneCricketeer Sep 07 '17 at 03:17
  • 1
    Yes, I have run `brew install python` on the second laptop too. But `pip` still installs into `/Library/Python/2.7/site-packages` – alphanumeric Sep 07 '17 at 03:18
  • Then your pip isn't the brew installed version – OneCricketeer Sep 07 '17 at 03:19
  • Possible duplicate of [Install a Python package into a different directory using pip?](https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip) – halfelf Sep 07 '17 at 03:20
  • Thanks for the link to another similar post. But I don't want to point `pip` installer with the `--target` flag. I want to make a second laptop to act like the first. I would like to know what setting makes a first laptop guide `pip` installer to `/usr/local/lib/python2.7/site-packages`. – alphanumeric Sep 07 '17 at 03:23
  • It's your `PATH` variable. `/usr/bin/pip` is not the same as `/usr/local/bin/pip` and you might just need to run `brew unlink python && brew link python` – OneCricketeer Sep 07 '17 at 03:27
  • 1
    Try `virtualenv` – Will Sep 07 '17 at 03:46

0 Answers0