Linux:CentOS7
python:
The system default python version 2.7, use python start
Install their own python version 3.8, use python3 start
Problem Description:
When using the virtualenvwrapper create a virtual environment in such an environment, the following error occurred
/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.
https://blog.csdn.net/Sun_White_Boy/article/details/81144924
The reason is the following code in virtualenvwrapper.sh
# Locate the global Python where virtualenvwrapper is installed. if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ] then VIRTUALENVWRAPPER_PYTHON="$(command \which python)" fi
So, when virtualenvwrapper initialization command " Which Python " is called python2.7, and my virtualenvwrapper by pip3 download, so there will be error " No Module named virtualenvwrapper "
Solution:
Directly modify its command statement
VIRTUALENVWRAPPER_PYTHON="$(command \which python3)"
Reference article: https://blog.csdn.net/Sun_White_Boy/article/details/81144924