2

I would like to make the jump and get acquainted with Python 3. I followed the instructions found here with the installation working flawlessly.

I'm also able to use the provided virtualenv to create enviroments for Python 2 and Python 3 (Followed the instuctions here.). Unfortunalty pip3 fails when no virtualenv is activated. I need to use it to install global modules for 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. Is there any workaround for this?

Community
  • 1
  • 1
bentrm
  • 1,018
  • 3
  • 10
  • 26
  • It's not really an answer, but I would recommend using ``pyenv`` (available from ``Homebrew``) to install concurrent Python versions. ``Virtualenv`` is mostly intended for managing package environments, not interpreters. – fjarri Aug 08 '13 at 07:52
  • Thanks for the heads up. I just tried the installation again and it seems to work fine now. I'm assuming that I must have set the Pythonpath as @demersus suggested. Or the brew build has been updated in some way. – bentrm Aug 08 '13 at 10:12

1 Answers1

2

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. 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.

glglgl
  • 89,107
  • 13
  • 149
  • 217
  • I forget about my intentions to try out pyhton3 and just tested it again. Seems to work now, though I haven't changed anything. I'm fairly sure that I followed the brew instructions not setting the PYTHONPATH as you suggested, but can't really recall that now. Anyway, you're solution seams to work for others so I assume it was my problem as well. – bentrm Aug 08 '13 at 10:09