我在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