python-3.xpython-2.7ubuntupip

How to install modules in Python 2.7 instead of Python 3.6?


I have two versions of Python in my laptop. Python 2.7 and Python 3.6. If install a module this is installed only in Python 3.6.

I would like to install modules in Python 2.7 through pip but I don't know how to do it.

I want to install right now GDAL and Fiona for Python 2.7 in Ubuntu 17.04.


Solution

  • If Python 2.7 is well installed on your system, you should have python2 and/or python2.7 commands and you could run the following:

    python2.7 -m pip install <your-packages>
    

    To make sure you are running the correct python version, you can use python2.7 --version