0

I had my mac osx working fine with python 2.7.10, and I've installed python3 via brew install python3.

on my bash_profile I then create an alias python=python3.

but when I

>>python3

I got:

Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x! PYTHONPATH is currently: "/usr/local/lib/python2.7/site-packages:" You should unset PYTHONPATH to fix this.

then I ran brew uninstall python3, but things did not come to previous configuration, and I couldn't run neither python versions anymore.

>>python now gives me:

-bash: python3: command not found

I tried then to brew link python3, since it appeared to be there, but to no avail.

now, If I which python, I get:

/usr/local/bin/python.

how do I fix this mess, minding that I want to keep both 2.7 and 3.5?

ps. my bash_profile now:

export PATH=“/usr/local/bin:/usr/local/sbin:/usr/bin:~/bin:./bin:$PATH"
"export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198

1 Answers1

0

Attempt to set the PYTHONPATH environment variable manually to point to the correct python installation. If you want both, set it to both (separated with a ; semicolon) and just specify in the cmd python2 or python3 depending on which you want to open.

This explains how to access the enviorment variables on OSX:

Setting environment variables in OS X?

Sorry, I'd provide more detail but I only run Linux and Windows on my home machines so I don't know much about OSX.

edit: actually, you may need to seperate different locations with a , comma rather then semicolon. Don't know, look at the existing ones to see how it is.

Community
  • 1
  • 1
Ashwin Gupta
  • 2,159
  • 9
  • 30
  • 60