catscoolzhyk
catscoolzhyk

Reputation: 685

Error while installing mysqlclient on MacOS Sierra (Python 3.6)

I'm trying to install mysqlclient for my MacOS Sierra (Python3).

Well, I tried to follow instructions on official page https://github.com/PyMySQL/mysqlclient-python.

So, everything was good until:

pip install mysqlclient
pip3 install mysqlclient

It throws me next things:

Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
  Complete output from command python setup.py egg_info:
  Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/q4/j199zrpj015c7dyj7qfl22qm0000gn/T/pip-build-9v6DOo/mysqlclient/setup.py", line 17, in <module>
    metadata, options = get_config()
      File "setup_posix.py", line 54, in get_config libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "setup_posix.py", line 12, 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/var/folders/q4/j199zrpj015c7dyj7qfl22qm0000gn/T/pip-build-9v6DOo/mysqlclient/

If anyone has some ideas to fix it, help me please. (Libraries was downloaded with brew). I have suspicion on having both Python 2.7 and Python 3.6 on my mac. But, actually I don't know :)

EDIT: Spent hours of search, still couldn't find an answer

Upvotes: 1

Views: 2602

Answers (2)

Kingz
Kingz

Reputation: 1717

Your pip is old. First upgrade it and then try.

pip3 install -U pip
sudo pip3 install mysqlclient

Upvotes: 0

catscoolzhyk
catscoolzhyk

Reputation: 685

https://stackoverflow.com/a/43645248/7136153 this helps me. I do following:

brew uninstall mysql-connector-c
brew install mysql
pip3 install mysqlclient

Upvotes: 10

Related Questions