前提系统中已安装python、mysql数据库:
第一步(终端输入):
$ export PATH=$PATH:/usr/local/mysql/bin
第二步(终端输入):
$ sudo pip install MySQL-Python
下面记录下本人出现的问题:
Collecting mysql-python==1.2.5 Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, inFile "/private/var/folders/2z/z51jnp914wzbdtch5q5by7140000gn/T/pip-build-_pJg9s/mysql-python/setup.py", line 17, inmetadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
这个问题困扰了好久. 最后是个各种办法都没有安装成功. 最后想到会不会是mysql的问题呢; 由于之前是用dmg文件安装的MySQL.所以现在尝试用brew安装,提示已经安装;然后有提示链接有问题,按照提示删除原来的链接,用brew重新链接.
解决问题.
have fun! 希望能帮到你