Virtualenv包装器在Mac上与python2不兼容?

时间:2019-04-09 19:16:52

标签: python macos-mojave virtualenvwrapper six

我正在使用virtualenvwrapper。在使用High Sierra的以前的计算机上,它运行良好,但是我有一台装有Mojave的新计算机。

这样做的效果似乎是,当我尝试使用pip安装virtualenvwrapper时,我得到了:

Installing collected packages: six, stevedore, virtualenvwrapper
  Found existing installation: six 1.4.1
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

如果我尝试升级六个,我会得到同样的结果...

如果我安装了pip3,则可以正常工作。

但是,/ usr / bin / python仍然是python2,因为这似乎没有人在改变。因此,每当我尝试使用virtualenvwrapper时,都会显示:

/usr/bin/python: No module named virtualenvwrapper

我试图删除/ usr / bin / python,或使其链接到python3之类的东西,但是我没有权限,即使使用sudo也是如此。

我不确定这是我能解开的结的那一部分...

ETA:运行的实际输出:

turlingdrome$ mkvirtualenv testenv -p python3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/brianp/work/venvs/testenv/bin/python3.7
Also creating executable in /Users/brianp/work/venvs/testenv/bin/python
Installing setuptools, pip, wheel...
done.
/usr/bin/python: No module named virtualenvwrapper
turlingdrome$ workon testenv
/usr/bin/python: No module named virtualenvwrapper
/usr/bin/python: No module named virtualenvwrapper
(testenv) turlingdrome$ python
Python 3.7.3 (default, Mar 27 2019, 09:23:15) 
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
(testenv) turlingdrome$ deactivate
/usr/bin/python: No module named virtualenvwrapper
/usr/bin/python: No module named virtualenvwrapper
turlingdrome$ 

它是否正确设置了所有内容?我不知道。通常,mkvirtualenv会自动激活您刚刚创建的环境...

设置VIRTUALENVWRAPPER_PYTHON时,我得到:

turlingdrome$ export VIRTUALENVWRAPPER_PYTHON=python3
turlingdrome$ mkvirtualenv test2 -p python3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/brianp/work/venvs/test2/bin/python3.7
Also creating executable in /Users/brianp/work/venvs/test2/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/brianp/work/venvs/test2/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/brianp/work/venvs/test2/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/brianp/work/venvs/test2/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/brianp/work/venvs/test2/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/brianp/work/venvs/test2/bin/get_env_details
/Users/brianp/work/venvs/test2/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
/Users/brianp/work/venvs/test2/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
(test2) turlingdrome$ 

0 个答案:

没有答案