Resolving 2 Python version in Mac OSX

喜欢而已 提交于 2019-12-12 03:12:26

问题


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 i.e (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 :)


回答1:


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



来源:https://stackoverflow.com/questions/39109843/resolving-2-python-version-in-mac-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!