Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Max OSX上安装mysqlclient时出错_Mysql_Python 3.6 - Fatal编程技术网

在Max OSX上安装mysqlclient时出错

在Max OSX上安装mysqlclient时出错,mysql,python-3.6,Mysql,Python 3.6,我正在尝试在MacOSX上安装mysqlclient,Django要求我使用MySql而不是SQLiteDB 我最初尝试了pip3安装mysqlclient,但遇到了如下错误: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3f/1z_bg4h52lz8n0_gc1mp7gwh0000gn/T/pip-install-em4vq6dr/mysqlclient/ 我在谷歌上做

我正在尝试在MacOSX上安装mysqlclient,Django要求我使用MySql而不是SQLiteDB

我最初尝试了
pip3安装mysqlclient
,但遇到了如下错误:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3f/1z_bg4h52lz8n0_gc1mp7gwh0000gn/T/pip-install-em4vq6dr/mysqlclient/
我在谷歌上做了很多搜索,尝试了很多建议(这似乎是一个常见的问题),但现在我得到的错误消息更是一团糟:

Collecting mysqlclient==1.3.1
  Downloading https://files.pythonhosted.org/packages/6b/ba/4729d99e85a0a35bb46d55500570de05b4af10431cef174b6da9f58a0e50/mysqlclient-1.3.1.tar.gz (76kB)
    100% |████████████████████████████████| 81kB 2.0MB/s 
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-install-4nhdinpy/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-wheel-41536ku7 --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.6
  copying _mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
  creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
  creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.9-x86_64-3.6
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,3,1,'final',1) -D__version__=1.3.1 -I/usr/local/Cellar/mysql/8.0.15/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
  _mysql.c:40:10: fatal error: 'my_config.h' file not found
  #include "my_config.h"
           ^~~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-install-4nhdinpy/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/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-record-o9decnbp/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.6
    copying _mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6
    creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
    creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.9-x86_64-3.6
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,3,1,'final',1) -D__version__=1.3.1 -I/usr/local/Cellar/mysql/8.0.15/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.6/_mysql.o
    _mysql.c:40:10: fatal error: 'my_config.h' file not found
    #include "my_config.h"
             ^~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-install-4nhdinpy/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/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-record-o9decnbp/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/z_/k_j3hrx10gn5w244fpvzw01r0000gn/T/pip-install-4nhdinpy/mysqlclient/
有人对我的错误有什么建议吗

使用Python 3.6

谢谢


克里斯已经根据这篇文章修复了它——但我只做了这一点:

运行
brew信息openssl

然后输入以下两个单独的命令

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
然后:


我根据这篇文章修复了它--但我只做了这一点:

运行
brew信息openssl

然后输入以下两个单独的命令

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
然后: