我在http://www.mysql.com/downloads/connector/c/找到了mysqllib。如何在没有安装MySQL服务器的情况下安装Python MySQLdb
那么我可以在不安装MySQL服务器的情况下安装MySQLdb吗?
只需将mysqlib复制到/usr/local/mysql
?
难道有可能吗?以及如何做到这一点?
哪个版本会匹配我的机器(我使用OSX Lion)?
我想用它连接到Django的另一台机器上的MySQL服务器。
感谢您的帮助!
================================
件事,我曾尝试已经
提取到/ usr /本地/ MySQL的
下载的MySQL的Python-1.2.3
创建符号链接的gcc-4.2至GCC(因为当它编译运行gcc-4.2而不是gcc)
- 在MySQL的Python-1.2.3文件夹编辑setup_posix.py
编辑mysql_config.path =“/ USR /本地/ MySQL的/斌/ mysql_config”
sudo的蟒蛇setup.py干净
编辑_mysql.c每一个包括mysqllib到正确的路径
例如#包括 “的mysql.h” ===>的#include “/usr/local/mysql/include/mysql.h”
- sudo的蟒蛇的setup.py建立
,我发现这个错误
Oats-MacBook:MySQL-python-1.2.3 Oat$ sudo python setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-2.7
creating build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
creating build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-2.7
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:185:1: warning: "SIZEOF_LONG" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:9,
from pymemcompat.h:10,
from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:54:1: warning: this is the location of the previous definition
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:205:1: warning: "SIZEOF_SIZE_T" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:9,
from pymemcompat.h:10,
from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:56:1: warning: this is the location of the previous definition
gcc-4.2 -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g build/temp.macosx-10.6-intel-2.7/_mysql.o -L/usr/local/lib -lmysql -lpthread -o build/lib.macosx-10.6-intel-2.7/_mysql.so
ld: warning: directory not found for option '-L/usr/local/lib'
ld: library not found for -lmysql
collect2: ld returned 1 exit status
ld: warning: directory not found for option '-L/usr/local/lib'
ld: library not found for -lmysql
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccnEbgua.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
我使用OSX Lion 我想连接到另一台机器上的MySQL服务器 – Geno 2012-02-13 17:32:16