Почему я не могу установить mysqlclient == 1.3.10 - PullRequest
0 голосов
/ 04 октября 2018

Я использую новую MacOS High Sierra 10.13.5.

Сначала я установил python3 с помощью Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python

, затем я клонировал свой репозиторий проекта python из github, который имеетФайл needs.txt со строкой:

mysqlclient==1.3.10 

Затем я создал виртуальную среду и запустил установку pip:

python3 -m venv venv
pip install -r api/requirements.txt

, а затем получил следующую ошибку:

...
...
Installing collected packages: six, python-dateutil, aniso8601, 
appdirs, jmespath, docutils, botocore, s3transfer, boto3, click, Werkzeug, itsdangerous, MarkupSafe, Jinja2, Flask, Flask-Cors, blinker, Flask-Mail, jsonschema, pytz, flask-restplus, Flask-Script, SQLAlchemy, Flask-SQLAlchemy, Flask-SQLAlchemy-Session, Mako, python-editor, alembic, Flask-Migrate, PyJWT, Flask-JWT-Simple, idna, pycparser, cffi, asn1crypto, cryptography, chardet, certifi, urllib3, requests, nexmo, pyparsing, packaging, Pillow, phonenumbers, numpy, timezonefinder, decorator, ratelim, geocoder, SQLAlchemy-Utils, mysqlclient, pycrypto, simple-crypt, suds-jurko, Salesforce-FuelSDK, schedule, python-utils, progressbar2, timeago
  Running setup.py install for aniso8601 ... done
  Running setup.py install for itsdangerous ... done
  Running setup.py install for MarkupSafe ... done
  Running setup.py install for blinker ... done
  Running setup.py install for Flask-Mail ... done
  Running setup.py install for Flask-Script ... done
  Running setup.py install for SQLAlchemy ... done
  Running setup.py install for Flask-SQLAlchemy-Session ... done
  Running setup.py install for Mako ... done
  Running setup.py install for python-editor ... done
  Running setup.py install for Flask-JWT-Simple ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for geocoder ... done
  Running setup.py install for SQLAlchemy-Utils ... done
  Running setup.py install for mysqlclient ... error
    Complete output from command /Users/mvi/mvi/server/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-record-6eq5p42p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mvi/mvi/server/venv/include/site/python3.7/mysqlclient:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.13-x86_64-3.7
    creating build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/compat.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
    creating build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.13-x86_64-3.7
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/local/mysql/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/mvi/mvi/server/venv/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.7/_mysql.o
    _mysql.c:29:10: fatal error: 'my_config.h' file not found
    #include "my_config.h"
             ^~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/Users/mvi/mvi/server/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-record-6eq5p42p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mvi/mvi/server/venv/include/site/python3.7/mysqlclient" failed with error code 1 in /private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

На моей старой MacBook Pro, где у меня не было этой проблемы.На этом MacBook у меня есть Python 3.6.5 с использованием GCC 4.2.1.На этом новом macbook у меня есть python 3.7, использующий clang 9.1.0 (venv) $ python Python 3.7.0 (по умолчанию, 22 августа 2018, 15:22:33) [Clang 9.1.0 (clang-902.0.39.2)] на darwin

Эта статья - единственная вещь, которую я могу связать, но, похоже, она не очень помогает ...

https://medium.com/@MrWeeble/homebrew-on-mac-and-pythons-mysqlclient-ea44fa300e70

Будем благодарны за любые идеи по отладке.Спасибо.

1 Ответ

0 голосов
/ 05 октября 2018

Вам нужна клиентская библиотека MySQL и связанные с ней заголовки.

Они поставляются, например, в пакете MariaDB (MySQL fork) в Brew, поэтому brew install mariadb должно помочь.

...