在MacOSX 10.14.15上对MKvirtualenv进行故障排除

时间:2019-05-22 14:05:32

标签: python-3.x macos homebrew mkdir macos-mojave

我这里需要些灯。我通过运行brew install python3安装了Python3,得到的消息是一切都已正确安装。我还通过运行sudo pip3 install virtual env virtualenvwrapper安装了virtualenv和virtualenvwrapper(我知道我不应该使用sudo运行它,但是我需要在这里执行)。当我运行命令时,我得到以下信息:

WARNING: The directory '/Users/anarenault/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (16.6.0)
Requirement already satisfied: virtualenvwrapper in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (4.8.4)
Requirement already satisfied: stevedore in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from virtualenvwrapper) (1.30.1)
Requirement already satisfied: virtualenv-clone in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from virtualenvwrapper) (0.5.3)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from stevedore->virtualenvwrapper) (5.2.0)
Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from stevedore->virtualenvwrapper) (1.12.0)

但是当我尝试运行mkvirtualenv myapp时,我得到以下信息: zsh: command not found: mkvirtualenv

我已经尝试按照本教程https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717,本教程https://gist.github.com/heymonkeyriot/9a2f429caff5c091d5429666fa080403和本教程https://techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/导出路径,但没有任何效果。

另外,当我运行/bin/bash --login时,我得到以下信息:

bash: /path/to/virtualenvwrapper.sh: No such file or directory
bash: /Users/anarenault/.local/bin/virtualenvwrapper.sh: No such file or directory
bash: /usr/bin/python3: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.

此外,当我尝试运行source /usr/local/bin/virtualenvwrapper.sh时,我得到以下信息:

/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.

如果您需要我提供更多信息,请问!谢谢大家。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。我使用了命令:export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python,它起作用了。谢谢!