1

So far I installed my virtualenv with mkvirtualenv --python=python2.7 venv.

(venv) ┌─╼ [~/Projects/Work_Projects]
└────╼ pip --version
pip 9.0.1 from /home/infinity/.virtualenvs/p38/local/lib/python2.7/site-packages (python 2.7)
(venv) ┌─╼ [~/Projects/Work_Projects]
└────╼ python --version
Python 3.6.3
(venv) ┌─╼ [~/Projects/Work_Projects]
└────╼ python
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/infinity/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages']

Why pip use python2.7, but my default python version is 3.6.3? How could I change that in considering I am in a virtualenv? In other words, I want python 3.6 out my virtualenv venv and python 2.7 inside my virtualenv.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.