在M上安装MySQL Python驱动程序

2024-04-19 08:45:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我运行MAMP和Python作为CGI。我想连接MySQL。我尝试用pip安装MySQLDb,但它没有工作,python根本找不到MySQLDb。在

你能告诉我如何使用Macport provider安装它吗?我已经安装了Apache、MySQL和python2.6?在

谢谢

更新:

通过pip安装得到以下O/p:

Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded Running setup.py egg_info for package mysql-python warning: no files found matching 'MANIFEST' warning: no files found matching 'ChangeLog' warning: no files found matching 'GPL' Installing collected packages: mysql-python Running setup.py install for mysql-python building '_mysql' extension /usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D_version_=1.2.3 -I/usr/local/Cellar/mysql/5.5.15/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-x86_64-2.6/_mysql.o -g In file included from _mysql.c:36: /usr/local/Cellar/mysql/5.5.15/include/my_config.h:330:1: warning: "SIZEOF_SIZE_T" redefined In file included from /opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9, from pymemcompat.h:10, from _mysql.c:29: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:37:1: warning: this is the location of the previous definition In file included from _mysql.c:36: /usr/local/Cellar/mysql/5.5.15/include/my_config.h:423:1: warning: "HAVE_WCSCOLL" redefined In file included from /opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8, from pymemcompat.h:10, from _mysql.c:29: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:808:1: warning: this is the location of the previous definition /usr/bin/gcc-4.2 -L/opt/local/lib -bundle -undefined dynamic_lookup build/temp.macosx-10.6-x86_64-2.6/_mysql.o -L/usr/local/Cellar/mysql/5.5.15/lib -lmysqlclient_r -lpthread -lz -lssl -lcrypto -o build/lib.macosx-10.6-x86_64-2.6/_mysql.so warning: no files found matching 'MANIFEST' warning: no files found matching 'ChangeLog' warning: no files found matching 'GPL' Successfully installed mysql-python Cleaning

我使用的是MAMP附带的MySQL。我还在MAMP文件夹中设置了MySQL二进制文件的路径

另一个更新

结果发现Mysql Python egg根本没有安装在:

/Library/Python/2.6/site包

我错过了什么?在


Tags: nofromincludeusrlocallibrarymysqlframework