Change setuptools gcc buildpath for Python
I'm trying to install MySQLdb-python on a server I don't have root on. It doesn't have appropriate mysql development files that python setup.py build
would usually compile into _mysql.so. I've obtained the files, and placed them in my home directory, however I can't get the build script to find them.
When I run the build command, the script spits out a massive gcc line:
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARG开发者_如何学运维EFILE_SOURCE -fno-strict-aliasing -fwrapv
the -I/usr/include/mysql is the problem. I need to change that to -I/home/user/mysql. I've tried to manually run the gcc line myself, but I know absolutely nothing about gcc or c in general.
Is there any python-y way to change the include directories?
I believe inside file setup.py, there is a list call include_dirs
. You can include your folder here. If there is the setup.cfg
file with the setup archive, you can put your path inside that too. Hope it helps.
you can modify the file: site.cfg in the 'options' section there is a config key named 'mysql_config' which is a mysql command line tool. just set it to your own mysql install path
精彩评论