问题
I'm trying to set up Django. I have Python 3.6 installed, and I installed virtualenvwrapper using pip3.
Here is what my bash profile looks like:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenv"
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
export PROJECT_HOME=$HOME/Devel
source /Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenvwrapper.sh
Every time I run
$ mkvirtualenv my_django_env
I get
ERROR: virtualenvwrapper could not find virtualenv in your path
回答1:
Note: This answer should have been posted here as it is more relevant to this question.
I cannot tell you how stable solution this is going to be for others. What worked for me is adding Lazy Loading which is described as an alternative initialization script. The error I was getting is that
mkvirtualenv is not in your PATH
when I tried to fire up a virtual env. Adding below script to my .zshrc file helped.
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh
Please also check this out for the whole process of installing and creating virtualenv and virtualenvwrapper pacakages.
来源:https://stackoverflow.com/questions/48630276/cant-find-virtualenv-in-path-even-though-its-there