【发布时间】:2018-11-15 11:49:07
【问题描述】:
我目前在本地安装了 Python 2.7 和 3.6。我用 pip3 安装了 virtualenv 和 virtualenvwrapper。当我没有指定 python 版本(即 $ mkvirtualenv hello)时,一切顺利,我得到以下输出:
"使用基本前缀 '/home/rishi_gurnani/python' /home/rishi_gurnani/.virtualenvs/hello/bin/python3.6 中的新 python 可执行文件 还在 /home/rishi_gurnani/.virtualenvs/hello/bin/python 中创建可执行文件 安装 setuptools、pip、wheel...完成。 virtualenvwrapper.user_scripts 创建 /home/rishi_gurnani/.virtualenvs/hello/bin/predeactivate virtualenvwrapper.user_scripts 创建 /home/rishi_gurnani/.virtualenvs/hello/bin/postdeactivate virtualenvwrapper.user_scripts 创建 /home/rishi_gurnani/.virtualenvs/hello/bin/preactivate virtualenvwrapper.user_scripts 创建 /home/rishi_gurnani/.virtualenvs/hello/bin/postactivate virtualenvwrapper.user_scripts 创建 /home/rishi_gurnani/.virtualenvs/hello/bin/get_env_details"
但是,当我指定我想要 python2.7(即 $ mkvirtualenv -p python2.7 hello2)时,我得到:
“使用解释器 /home/rishi_gurnani/python/bin/python2.7 运行 virtualenv”
所以没有在任何地方创建 virtualenv。换句话说,我只能用 Python 3.6 创建一个 virtualenv。但我也想创建一个使用 2.7 的版本。
【问题讨论】:
-
那么你的问题到底是什么?
-
@mentallurg virtualenv 支持创建使用不同版本 python 的环境的能力。为什么我不能这样做?
标签: python python-3.x python-2.7 virtualenv virtualenvwrapper