4

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.

2

2 Answers 2

8

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

Sign up to request clarification or add additional context in comments.

1 Comment

It's py -2.7 -m pip install
1

Better use virtual environment for this. Follow this link https://realpython.com/blog/python/python-virtual-environments-a-primer/

You can set python version to use in virtual env using

virtualenv -p path/to/python2.7 env_name

Activate this env using . env_name/bin/activate then,

Use pip install package_name to install libraries inside virtual environment

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.