0
我按照下面的網站中的步驟操作,併爲MySQLdb安裝了所有的操作。我使用Xampp作爲數據庫,並且已將mysql_config鏈接到xampp mysqlconfig。 http://www.tutorialspoint.com/python/python_database_access.htm
然而,後安裝了一切,當我嘗試導入它說:無法將MySQLdb導入python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.9-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.9-intel.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.9-intel.egg/_mysql.so
Reason: image not found
由於提前爲您的幫助!
您是否意識到MySql必須作爲軟件包下載並安裝的事實?你使用'pip'安裝了嗎? – 2014-09-28 06:36:47
@sammy不,我沒有。我剛剛從網站上下載了這個文件,並按照他們的指示。順便說一下,我在Mac上。 – Nazariy1995 2014-09-28 06:39:37
好的。但我也使用MySqldb,對我來說工作正常。我的答案正確地上升了 – 2014-09-28 06:43:01