gpt4 book ai didi

Python + Django : Trouble with setting up mkvirtualenv on macOS

转载 作者:太空宇宙 更新时间:2023-11-03 14:07:59 25 4
gpt4 key购买 nike

我使用的是 macOS (10.13.3) 并安装了 Python v 3.6.4

我正在尝试按照 Mozilla 文章中的说明进行操作:https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment

我的流程:

1 which python » /usr/local/bin/python 注意,在此过程中我做了一个符号链接(symbolic link) 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 » 添加以下内容: »

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 源 ~/.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捂脸

<小时/>

我的 .bash_profile 文件的完整内容:

# 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

我猜我的问题与以下内容有关,但我不知道这意味着什么,也不知道如何解决它,有人可以帮助我吗?

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

提前致谢!

最佳答案

我不完全确定,但我认为运行以下命令解决了我的问题:

pip3 install --upgrade virtualenv

关于Python + Django : Trouble with setting up mkvirtualenv on macOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48724220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com