gpt4 book ai didi

python - 使用 virtualenv 和错误消息 : - setuptools pip wheel failed with error code 1

转载 作者:行者123 更新时间:2023-11-30 22:32:23 25 4
gpt4 key购买 nike

多年来,我的 Mac 上安装了相当多的 Python 和 Anacondas,在某种程度上,这些都被忽视了,我怀疑现在又重新出现并给我带来了问题。

我想设置一个virtualenv环境并执行pip install virtualenv。我想为 Django1.8 创建一个新环境 Django18,但是在执行命令 virtualenv Django18 后,我收到一条错误消息:

OSError: Command ~/Desktop/Django18/bin/python - setuptools pip wheel failed with error code 1

bash_profile

# added by Anaconda2 4.2.0 installer
export PATH="~/anaconda2/bin:$PATH"

命令:哪个python

~/anaconda2/bin/python

在/usr/bin/中:

-rwxr-xr-x     2 root   wheel     58416 Jul 15  2015 python
-rwxr-xr-x 5 root wheel 925 Sep 10 2014 python-config
lrwxr-xr-x 1 root wheel 75 Nov 9 2014 python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x 1 root wheel 82 Nov 9 2014 python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x 1 root wheel 75 Nov 9 2014 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 Nov 9 2014 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 2 root wheel 58416 Jul 15 2015 pythonw
lrwxr-xr-x 1 root wheel 76 Nov 9 2014 pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x 1 root wheel 76 Nov 9 2014 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

.profile

export PATH="/opt/local/lib/gmt4/bin:$PATH"
export PATH="~/teqc:$PATH"
export PATH="/usr/local/runpkr000:$PATH"
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

# MacPorts Installer addition on 2015-04-02_at_16:40:23: adding an appropriate PATH variable for use with MacPorts.
# export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

# added by Anaconda 2.3.0 installer
# export PATH="~/anaconda/bin:$PATH"

我怀疑需要对此进行一些清理,但是如何解决此错误消息并让 virtualenv 按预期工作?我已经尝试了几种已经存在的方法,但在应用潜在的补救措施之前,我很难识别出在我的情况下到底是什么导致了这个问题。

<小时/>

/opt/local/bin(这是macports安装)?:

lrwxr-xr-x    1 root  admin       24 Oct  9  2016 python -> /opt/local/bin/python2.7
lrwxr-xr-x 1 root admin 31 Oct 9 2016 python-config -> /opt/local/bin/python2.7-config
lrwxr-xr-x 1 root admin 73 Dec 14 2014 python2.7 -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root admin 80 Dec 14 2014 python2.7-config -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x 1 root admin 25 Oct 9 2016 pythonw -> /opt/local/bin/pythonw2.7
lrwxr-xr-x 1 root admin 74 Dec 14 2014 pythonw2.7 -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

/usr/Local/bin

lrwxr-xr-x   1 root    staff        69 Dec 12  2012 python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3
lrwxr-xr-x 1 root staff 72 Dec 12 2012 python3-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3-32
lrwxr-xr-x 1 root staff 76 Dec 12 2012 python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3-config
lrwxr-xr-x 1 root staff 71 Dec 12 2012 python3.3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3
lrwxr-xr-x 1 root staff 74 Dec 12 2012 python3.3-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3-32
lrwxr-xr-x 1 root staff 78 Dec 12 2012 python3.3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3-config
lrwxr-xr-x 1 root staff 72 Dec 12 2012 python3.3m -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3m
lrwxr-xr-x 1 root staff 79 Dec 12 2012 python3.3m-config -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3m-config
lrwxr-xr-x 1 root staff 70 Dec 12 2012 pythonw3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3
lrwxr-xr-x 1 root staff 73 Dec 12 2012 pythonw3-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3-32
lrwxr-xr-x 1 root staff 72 Dec 12 2012 pythonw3.3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3
lrwxr-xr-x 1 root staff 75 Dec 12 2012 pythonw3.3-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3-32

导入系统系统路径

~/anaconda2/lib/python27.zip
~/anaconda2/lib/python2.7
~/anaconda2/lib/python2.7/plat-darwin
~/anaconda2/lib/python2.7/plat-mac
~/anaconda2/lib/python2.7/plat-mac/lib-scriptpackages
~/anaconda2/lib/python2.7/lib-tk
~/anaconda2/lib/python2.7/lib-old
~/anaconda2/lib/python2.7/lib-dynload
~/anaconda2/lib/python2.7/site-packages
~/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.6-py2.7.egg
~/anaconda2/lib/python2.7/site-packages/aeosa
~/anaconda2/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg

/opt/local/Library/Frameworks:

Python.framework

/系统/库/框架

Python.framework
<小时/>

编辑

哪个 python 生成:

~/anaconda2/bin/python

which -a python 产生:

~/anaconda2/bin/python
/usr/bin/python

它们不一样。但是删除 python 安装后:

/opt/local/bin
/usr/Local/bin
/usr/bin

并在

中使用 rm -rf python*sudo rm -rf python*
/opt/local/Library/Frameworks

which 输出将变得相同。

我意识到 which python 命令实际上指的是 .bash_profile 文件中写入的内容,而不是 .profile (优先级到.bash_profile)。

无论如何,我在 .bash_profile 中注释掉了 $PATH,因此强制环境变量仅在 .profile 中使用> 文件。然后source ~/.bash_profile

在我的.profile中我添加了:

export PATH="/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages:$PATH

然后source ~/.profile

但是在 which python 之后我仍然得到:

~/anaconda2/bin/python

这有点令人沮丧,因为即使更改相关文件并删除某些 python 安装,结果仍然相同:-/

最佳答案

对我来说,最好的解决方法是首先检查 which -a python,在我的例子中,出现了两次:

~/anaconda2/bin/python
/usr/bin/python

出于某种未知的原因,virtualenv 命令似乎不喜欢 anaconda 安装的 python,因此请改用:

virtualenv -p /usr/bin/python2.7 my_environment

关于python - 使用 virtualenv 和错误消息 : - setuptools pip wheel failed with error code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45484327/

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