为什么我不能安装mysqlclient==1.3.10

cdmah0mi  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(425)

我用的是新的macos high sierra 10.13.5。
我首先使用自制软件安装了python3:

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

然后我从github克隆了我的python项目存储库,它有一个requirements.txt文件,该文件有以下行:

mysqlclient==1.3.10

然后我创建了一个虚拟env并运行了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.

在我以前的mac book pro上,我没有这个问题。在那个macbook上,我使用了使用gcc4.2.1的python3.6.5。在这个新的macbook上,我使用了Clang9.1.0(venv)$python3.7.0(默认值,2018年8月22日,15:22:33)[Clang9.1.0(Clang902.0.39.2)]在darwin上
这篇文章是我唯一能做的,似乎相关,但似乎没有什么帮助。。。
https://medium.com/@mrweeble/homebrew-on-mac-and-pythons-mysqlclient-ea44fa300e70上
任何关于调试的想法都将不胜感激。谢谢。

j2cgzkjk

j2cgzkjk1#

您需要mysql客户机库及其相关的头文件。
例如,brew中的mariadb(mysql fork)包提供了这些功能,因此 brew install mariadb 应该会成功的。

相关问题