user1941390 user1941390 - 1 month ago 5x
Python Question

pip: How to deal with different python versions to install Flask?

I have different versions of Python installed on my Ubuntu machine (2.7.11, 2.7.12, 3.5). I would like to install Flask on the 2.7.12 as it used by Apache.

I have three pip{version} in my PATH which are: pip, pip2, and pip2.7. How do I know which one is for which python version.

I have already read Here but it didn't help my case as I need to differentiate between minor version number 2.7.11 and 2.7.12.

One thing is that I tried pip{version} install Flask for all three pips but the 2.7.12 still can't import Flask.

Any help is much appreciate it.



You should always create virtualenvs for your projects. You can create one like

virtualenv -p <path/to/python2.7.12> <path/to/new/virtualenv/>

inside that virtualenv pip and python will always select the right interpreter and path.