尝试在Mac上安装MySQL-python,但保持错误

问题描述:

我在Mac 10.13上使用python 2.7 我已经在我的Mac上安装了MySQL,但是当我想安装MySQL-python时,不断收到错误。尝试在Mac上安装MySQL-python,但保持错误

我想点子:

须藤PIP安装mysql-python的

,但得到:

Collecting mysql-python 
    Downloading MySQL-python-1.2.5.zip (108kB) 
    100% |████████████████████████████████| 112kB 1.9MB/s 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/private/tmp/pip-build-AhyoBa/mysql-python/setup.py", line 17, in <module> 
     metadata, 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 

---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-AhyoBa/mysql-python/ 

然后我试图将文件直接移动到 '站点包' ,并跑了:

python /Users/dandizhao/Downloads/MySQL-python-1.2.5/setup.py install 

,但仍看到:

Traceback (most recent call last): 
    File "/Users/dandizhao/Downloads/MySQL-python-1.2.5/setup.py", line 17, in <module> 
    metadata, options = get_config() 
    File "/Users/dandizhao/Downloads/MySQL-python-1.2.5/setup_posix.py", line 32, in get_config 
    metadata, options = get_metadata_and_options() 
    File "/Users/dandizhao/Downloads/MySQL-python-1.2.5/setup_common.py", line 12, in get_metadata_and_options 
    metadata = dict(config.items('metadata')) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 642, in items 
    raise NoSectionError(section) 
ConfigParser.NoSectionError: No section: 'metadata' 

真的筋疲力尽......我试过很多方法,我可以找到,但他们没有工作......

我去this link here,它看起来这是一个很常见问题与MySQL和MacOS。

给这些命令的尝试在终端

$ brew uninstall mysql 
$ brew install mysql-connector-c 
$ brew unlink mysql-connector-c 
$ brew install mysql 
$ pip install mysql-python 
+0

哦,是的,非常感谢你!有用! –

+0

没问题!不要忘记打绿色复选标记以接受答案是正确的。 @赵丹迪 – Lewis