It sounds like you are getting a little confused.
Run the command
python
and you will see something similar to
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
This is the Python into which pip
will, by default, install things. As you can see, my default Python at the command line is currently 3.4.3, but I have others available.
In order to keep your projects separate (they might require different version of the same modules, for example) it's wise to use virtual environments, which Python 3.4 can create for you. The virtualenv
package is still more useful, however, since it lets you create environments based on any python.
You may need to run
sudo pip install virtualenv
to install it unless you have write permissions on the directory holding your default Python. If you do, then
pip install virtualenv
should work. Then run the command
virtualenv --python=python2.7 /tmp/venv
to create your virtual environment. Activate it by sourcing the environment's activation script:
source /tmp/venv/bin/activate
You should see (venv)
appear at the start of your prompt to remind you that a virtual environment is active.
Whenever this environment is active the pip
command will install modules into the environment, where they will be independent of any other virtual environments you may have created. Deactivate it (to return to your standard default Python) with the command
deactivate