到目前为止我已经安装了我的虚拟环境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']
为什么 pip 使用 python2.7,但我的默认 python 版本是 3.6.3?考虑到我在虚拟环境中,我该如何更改它?换句话说,我希望我的虚拟环境 venv 中的 python 3.6 和虚拟环境内的 python 2.7。