How to correctly install virtualenvwrapper on mac

The benefits of virtualenv are good for those who have used them, but there are still some inconveniences. virtualenvwrapper provides a simple command line package for it.

There are some small troubles in installing virtualenvwrapper on mac. After consulting the information, the records are as follows.

Install virtualenv and virtualenvwrapper:

sudo pip install virtualenv
sudo pip install virtualenvwrapper


Find virtualenvwrapper.sh

which virtualenvwrapper.sh


The location on my machine is:
/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh

Modify .bash_profile
to open /Users/username/.bash_profile and add at the end:

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_SCRIPT=/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.4/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh

The middle 4 lines must be consistent with your local python version and path. Note here that if the above middle 4 lines are not added, the following error will appear:

/usr/bin/python: No module named virtualenvwrapper


So far you're done, you can use virtualenvwrapper conveniently.

Guess you like

Origin blog.csdn.net/zjj1898/article/details/103190678