我正在我的 Mac Lion 上设置 python/numpy/scipy/matplotlib/mysql。我首先安装了 Python 2.7.3 和 mysqldb。然后我更新到 XCode 4.3.3 并使用ScipySuperpack安装 numpy、scipy 等。
在这一点上,我可以在 python 中导入几个包而不会发生意外,但 matplotlib 如下所示:
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 numpy
>>> import scipy
>>> import _mysql
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.py:3:
UserWarning: Module _mysql was already imported from
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.pyc, but
/Users/myname/pypy is being added to sys.path
>>> import matplotlib
Error 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
对不起,如果问题是基本的,但我不明白警告,或者它可能与最终错误有什么关系......