What should be my python packages path?
<p>I'm on Mac OS X and I've heard that to avoid global installation of packages (using sudo) that might cause problems with the python files that OS X uses, the path to install python packages must be different than that of OS X. </p>

<p>Currently python executables are installed in : </p>

<pre><code>/usr/local/bin/
</code></pre>

<p>Pip installs modules over here : </p>

<pre><code>/usr/local/lib/python2.7/site-packages
</code></pre>

<p>Python is used from here : </p>

<pre><code>/usr/local/bin/python
</code></pre>

<p>Are these paths safe?</p>

<p>There are a number of options you can take, the easiest (as others have suggested) is <code>virtualenv</code>. Hopefully that's already installed if not, this is one of the few modules you should install globally. If you have Python 3.4+, you "should" have <code>venv</code> module (which is similar to virtualenv, but it's maintained by the Python team).</p>

<p><em>python2</em></p>

<pre><code>virtualenv ~/.py-venvs/python2
</code></pre>

<p><em>python3</em></p>

<pre><code>python3 -m venv ~/.py-venvs/python3
</code></pre>

<p>You could install modules to the local user using <code>pip</code>, but I'm not sure how well this is supported these days though:</p>

<pre><code>pip install --user requests
</code></pre>

<p>You could also append directories to the <code>$PYTHONPATH</code> bash variable, but this should only be done as a last resort and under parental supervision :D. Try the other methods before this one.</p>

python osx pip