If Python could not import the module virtualenvwrapper.hook_loader, and I get this message
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.
How do I start to set it up in Debian 9?
Installing virtualenv by both, pip
and pip3
doesn't make any sense because installing it by any one shows virutalenvwrapper in both, pip list
and pip3 list
.
The right way is to copy the following code in your ~/.bashrc
.
VIRTUALENVWRAPPER_PYTHON=$(which python3)
NOTE: Use the python version you want to use, in my case it's python3
.
You have to install virtualenvwrapper separately for different versions of Python:
pip install virtualenvwrapper
pip3 install virtualenvwrapper
The first one is for Python 2.7, the second for Python 3.
对于 MacOS,您需要将 VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 更改为 VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
This have solved my issue on macOS Monterey 2022:
Terminal
cd
nano .bashrc
Code in file
export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
save it
CTRL + x
y
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.