I'm using macOS (10.13.3) and have installed Python v 3.6.4
I'm trying to follow the instructions per this Mozilla article: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment
My process:
1 which python
» /usr/local/bin/python
note, somewhere along the way I did a Symlink ln -s /usr/local/bin/python3 /usr/local/bin/python
2 python3 -V
» Python 3.6.4
3 sudo -H pip3 install virtualenvwrapper
»
Requirement already satisfied: virtualenvwrapper in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: stevedore in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv-clone in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from stevedore->virtualenvwrapper)
4 nano .bash_profile
» Add following: »
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export WORKON_HOME=$HOME/.virtualenvs
# export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 # No impact
# export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 # No impact
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python # No impact
# VIRTUALENVWRAPPER_PYTHON=`which python` # No impact
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
5 source ~/.bash_profile
6 mkvirtualenv my_django_environment
»
Running virtualenv with interpreter /usr/local/bin/python
Using base prefix '/usr/local/bin/../../../Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/myuser/.virtualenvs/my_django_environment/bin/python
ERROR: The executable /Users/myuser/.virtualenvs/my_django_environment/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.6' (should be '/Users/myuser/.virtualenvs/my_django_environment')
ERROR: virtualenv is not compatible with this system or executable
7 Facepalm
Complete contents of my .bash_profile file:
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
I'm guessing my issue has to do with the following, but I have no idea what that means nor how to fix it, could someone please help me out?
ERROR: The executable /Users/myuser/.virtualenvs/my_django_environment/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.6' (should be '/Users/myuser/.virtualenvs/my_django_environment')
ERROR: virtualenv is not compatible with this system or executable
Thanks in advance!
我不完全确定,但我认为运行以下解决了我的问题:
pip3 install --upgrade virtualenv
Good that you managed to solve the issue.
Having used mkvirtualenv
for a while though, I recommend that you try Pipenv
if you haven't already.
Pipenv
records the python version that you are using in your virtualenv whereas virtualenvwrapper
(via pip freeze
) doesn't.
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.