Virtualwrapper需要完整的python3路径

时间:2017-10-15 20:09:17

标签: python virtualenvwrapper

为了避免sudo pip3安装virtualwrapper已经在我的Ubuntu上安装了virtualwrapper并使用apt:

sudo apt-get install virtualenv virtualenvwrapper    

当我只使用以下命令时,我会得到一个python 2.7环境:

mkvirtualenv测试

为了创建python3环境,以下命令行不起作用:

test@tester:~$ mkvirtualenv -p python3 test
The executable /home/test/python3 (from --python=/home/test/python3) does not exist

我命令有一个python3环境我必须使用以下命令:

mkvirtualenv -p /usr/bin/python3 py3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/test/.vens/py3/bin/python3
Not overwriting existing python script /home/test/.vens/py3/bin/python (you must use /home/test/.vens/py3/bin/python3)
Installing setuptools, pkg_resources, pip, wheel...done.

为什么使用-p python3命令无效?

当我使用与virtualenv相同的命令时,它可以工作:

test@tester:~$ virtualenv -p python3 test2
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/test/test2/bin/python3
Also creating executable in /home/test/test2/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

1 个答案:

答案 0 :(得分:2)

根据您收到的错误,virtualenvwrapper使用当前工作目录将-p选项传递给virtualenv

你应该这样做:

mkvirtualenv -p `which python3` test