PIP install and Python path

4

2

I am using pip install on a mac to get my python requirements for a django website.

I got pip from MacPorts

port install pip-2.7

Now the problem is the pip installs the packages in a location which is not in my python sys.path.

I just copied this bogus location

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

to a location present in my sys.path

/Library/Python/2.7/

Of course this worked ok, but I will use pip in the future so I need a persistent solution.

The question is how can I alter my sys.path to recognize that crap location or how do I tell pip to install dependencies somewhere else ?

Calin Paul Alexandru

Posted 2012-05-05T12:37:44.000

Reputation: 483

This question makes me queasy. – hmijail mourns resignees – 2017-06-16T11:36:17.577

Cross site duplicate, http://stackoverflow.com/q/10461590/425313

– Brad Koch – 2014-03-18T01:50:38.607

Answers

1

Documentation: Set the PYTHONPATH environment variable.

Daniel Beck

Posted 2012-05-05T12:37:44.000

Reputation: 98 421

I forgot to mention, but I have already tried that a few times. I set and export the $PYTHONPATH (which however I don't really understand why is empty). I open another terminal and and echo $PYTHONPATH prints the change.

However, opening a python interpretor and printing sys.path seems unchanged. – Calin Paul Alexandru – 2012-05-05T12:52:48.130

Oh, nevermind. It finally worked. – Calin Paul Alexandru – 2012-05-05T12:59:41.070