我正在尝试在我的macOS (使用zsh)中安装virtualenvwrapper (而不是pyenv-virtualenvwrapper)。我使用pyenv来管理多个python版本,使用pipx来安装命令行界面。
我使用的是Python 3.8.1
$ pyenv versions
system
2.7.17
* 3.8.1 (set by /Users/my_user/.pyenv/version)我用pipx安装了virtualenvwrapper
$ pipx install virtualenvwrapper
$ pipx list
venvs are in /Users/my_user/.local/pipx/venvs
apps are exposed on your $PATH at /Users/my_user/.local/bin
package sshuttle 0.78.5, Python 3.8.1
- sshuttle
package virtualenv 20.0.15, Python 3.8.1
- virtualenv
package virtualenvwrapper 4.8.4, Python 3.8.1
- virtualenvwrapper.sh
- virtualenvwrapper_lazy.sh我在我的.zshrc中插入了以下几行:
export WORKON_HOME=$HOME/.virtualenvs
source /Users/my_user/.local/pipx/venvs/virtualenvwrapper/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME但是当我启动shell时,我得到了以下错误:
/Users/my_user/.pyenv/versions/3.8.1/bin/python: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: 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=/Users/my_user/.pyenv/shims/python and that PATH is
set properly.
$我如何解决这个问题?
发布于 2020-03-28 00:13:32
修复了指定未指向填充程序的特定VIRTUALENVWRAPPER_PYTHON的问题
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/Users/my_user/.local/pipx/venvs/virtualenvwrapper/bin/python3.8
source /Users/my_user/.local/pipx/venvs/virtualenvwrapper/bin/virtualenvwrapper.shhttps://stackoverflow.com/questions/60885641
复制相似问题