简体   繁体   中英

Resolving 2 Python version in Mac OSX

I am running Mac OS X 10.11.5 . I have two Python versions on my machine:

  1. Python 2.7 (Inbuilt python in OSX) and

  2. Python 3.5 (Anaconda version- 4.1.1)

The path is set up as shown:

$PATH

-bash: /Users/userNMS/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

The problem is when I am trying to install few packages like pandas, Theano etc., using anaconda. I get ERROR: Failure: ImportError (No Module found)

By default the Python Path points to this one ie (Python version- 2.7)

> whereis python

/usr/bin/python

But my actual Path which I want to work is Python 3.5 (Anaconda version):

> which python

/Users/userNMS/anaconda/bin/python

The Python site packages path is as follows:

/Users/userNMS/anaconda/lib/python3.5/site-packages

The packages from site-packages ( say pandas, Theano etc., ) is not getting retrieved from the above path, giving away Import Error

Please help me on this !! Thanks in Advance :)

My approach would be to create a new conda enviornment and install your packages there. This will help you avoid any issues if you still want to use 2.7. Example would be:

conda create --name foo python=3 pandas Theano

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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