set different system paths for python 3.2 and python 2.7 globally
<p>I installed a module compiling the source code. I did that using python3.4 and the module is located at /usr/local/lib/python3.4/site-packages/. If I try to run it, python3.4 cannot find it. If I add the directory to PYTHONPATH, everything works.</p>

<p>But I have two versions of python (I'm running ubuntu). Python2.7 and python3.4. After I add the directory to PYTHONPATH it becomes:</p>

<pre><code>/home/myuser/development/ros/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages:/home/myuser/Qt/5.5/gcc_64/lib/cmake/lib/python2.7/dist-packages:/usr/local/lib/python3.4/site-packages/:/home/myuser/development/lcm
</code></pre>

<p>so that there are directories related to python2.7 and python3.4 in the same environment variable, which is totally unsafe and crazy I think. Its very error prone.</p>

<p>I've been looking around, and found that people recommend using virtualenv. Nevertheless, that doesn't change the PYTHONPATH. </p>

<p>What's the standard way to handle this? some thoughts:</p>

<ul>
<li>I would expect that python3.4 would automatically look for modules in /usr/local/lib/python3.4/site-packages/ and that is not happening. Maybe my python3.4 installation has something off?</li>
<li>Even if I manage to use that module for python3.4 without using PYTHONPATH I still have info in PYTHONPATH related to python2.7 even when I am using python3.4, so I should probably remove that too.</li>
</ul>

<p>So, how do I set the path for python to look for modules globally (not using sys.path() for each program) but with each python version using it's own path?</p>

<p>EDIT: From a comment, I realized that I could just add a symbolic link to the directory where my modules are. But I found that neither python 2.7 or 3.4 have site-packages in their path, which is wrong.. is this an ubuntu issue? I read somewhere that  site-packages should be used for self compiled modules, and dist-packages for modules installed via apt-get. </p>

<p>EDIT 2:  python#.#/site-packages is reserved for custom packages. At least in ubuntu, python won't look in there by default. So the behavior I was having was the correct one, nothing was wrong on the installation. </p>