preamble
I encountered a problem when installing virtualwrapper using mac, and it took me a long time to get it right, so I'll summarize it here and share it for those who encounter the same problem to use it and take less detours.
Problem Statement:
Mac defaults to python2, and I use a brew install of python3.
Here's what went wrong during my installation
1. Install virtualwrapper
Open a terminal and enter the following command
pip3 install virtualenv pip3 install virtualenvwrapper
2. Add code to the configuration file ~/.bash_profile
# Settings for virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/
3. Let the configuration take effect:
source ~/.bash_profile
At this point, the following question arises.
/usr/bin/python: No module named virtualenvwrapper : 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.
Cause analysis
From the error message VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly. This sentence shows that the environment is pointing to the path of python2, so we just need to change this environment variable to the path of python3.
method settle an issue
Open the configuration file vim ~/.bash_profile Add a line of code to the configuration file:
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
Let the configuration take effect:
source ~/.bash_profile
Try it again, great job!!!!
This is the whole content of this article.