我在Mac OS(Mountain Lion)上使用Macports安装了Python。
当我运行 $python 时,当我尝试导入pandas或matplotlib时,它会给出“无法导入urandom”错误。
如果我运行 $python 2.7, 一切都运行得很完美。
我想始终将Python更改为使用Python 2.7。
我尝试使用sudo port select python python27来实现这一点。但这并没有帮助。
请帮忙解决这个问题,我是Mac的新手。
我在Mac OS(Mountain Lion)上使用Macports安装了Python。
当我运行 $python 时,当我尝试导入pandas或matplotlib时,它会给出“无法导入urandom”错误。
如果我运行 $python 2.7, 一切都运行得很完美。
我想始终将Python更改为使用Python 2.7。
我尝试使用sudo port select python python27来实现这一点。但这并没有帮助。
请帮忙解决这个问题,我是Mac的新手。
PATH
的步骤,以使其首先查找Macport安装的可执行文件...〜/.profile
文件export PATH=/opt/local/bin:/opt/local/sbin:$PATH
如果我没记错的话,你可能想要执行 "sudo port activate python"
。那么 "which python"
命令告诉你什么?如果是 /usr/bin/python
,那么你正在使用OSX Python。而如果是 /usr/local/bin/python
,那么你可能在使用ports版本。