0

I use python 2.7 on Mac 10.13 I already have MySQL on my Mac, but when I wanna install MySQL-python, keep getting error.

I tried pip:

sudo pip install mysql-python

but got:

 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/

Then I tried to move the file directly to 'site-package',and ran:

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

but still got:

 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'

Really exhausted...I tried many methods I can find, but none of them works...

1 Answer 1

4

I went on this link here and it seems like this is a very common issue with MySQL and MacOS.

Give these commands a try in your terminal

$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.