简体   繁体   English

通过 Homebrew 并行安装 Python 2.7 和 3.3 - pip3 失败

[英]parallel installion of Python 2.7 and 3.3 via Homebrew - pip3 fails

I would like to make the jump and get acquainted with Python 3. I followed the instructions found here with the installation working flawlessly.我想进行跳转并熟悉 Python 3。我按照此处找到的说明进行安装,安装工作完美无缺。

I'm also able to use the provided virtualenv to create enviroments for Python 2 and Python 3 (Followed the instuctions here .).我还可以使用提供的 virtualenv 为 Python 2 和 Python 3 创建环境(遵循此处的说明。)。 Unfortunalty pip3 fails when no virtualenv is activated.不幸的是,当没有激活​​ virtualenv 时,pip3 会失败。 I need to use it to install global modules for python3.我需要用它来安装 python3 的全局模块。

This is the error message:这是错误消息:

± |master ✓| → pip3
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/distribute-0.6.45-py2.7.egg/pkg_resources.py", line 51
    def _bypass_ensure_directory(name, mode=0777):
                                               ^
SyntaxError: invalid token

It looks like pip3 is trying to access distribute of python2.看起来 pip3 正在尝试访问 python2 的分发。 Is there any workaround for this?有什么解决方法吗?

I was having the same problem as you were and I had我和你有同样的问题,我有

export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"

in my ~/.bash_profile.在我的 ~/.bash_profile 中。 Removing that line solved the problem for me.删除那条线为我解决了问题。 If you have that or something like it in your ~/.bashrc or ~/.bash_profile, try removing it.如果您的 ~/.bashrc 或 ~/.bash_profile 中有那个或类似的东西,请尝试删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM