我对 Python 比较陌生。这是我的问题:
我的环境是 python2.6 和 MacOs 10.6.8。我最近不得不用 Python2.7 和其他一些东西(Eclipse 3.6 和 GoogleAppEngine)更新我的系统。Python 在 Eclipse 中运行良好,但是,我希望保持 shell 模式能够在命令行上快速测试小东西。我收到此错误消息,我需要它尽快摆脱:
$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> import urllib2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py",
line 92, in <module>
import httplib
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py",
line 77, in <module>
import mimetools
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/mimetools.py",
line 6, in <module>
import tempfile
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/tempfile.py",
line 34, in <module>
from random import Random as _Random
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/random.py",
line 45, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/lib-dynload/math.so, 2): Symbol not found: __PyLong_AsScaledDouble
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/lib-dynload/math.so
Expected in: flat namespace
in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/math.so
无论如何,这是我的 macbook 在购买时附带的 python 版本。我不认为我想在删除、重新安装等苹果批准的 python 版本上浪费时间。有谁知道我怎样才能让我的系统恢复正常运行?为什么会发生这个错误?感谢您的快速帮助!