我在安装mysqlclient时出现一个奇怪的错误

时间:2019-09-25 04:46:06

标签: mysql pip

我正在尝试使用以下命令pip install mysqlclient在我的环境中安装mysqlclient。我将pip3用作默认的pip环境。我的pip版本是19.2.3。它不断抛出此错误:

Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/vince/mor_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-install-iyew72oj/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-install-iyew72oj/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/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-record-6oktp750/install-record.txt --single-version-externally-managed --compile --install-headers /Users/vince/mor_env/include/site/python3.6/mysqlclient
         cwd: /private/var/folders/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-install-iyew72oj/mysqlclient/
    Complete output (32 lines):
    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-intel-3.6
    creating build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/_exceptions.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/compat.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb
    creating build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-3.6/MySQLdb/constants
    running build_ext
    building 'MySQLdb._mysql' extension
    creating build/temp.macosx-10.6-intel-3.6
    creating build/temp.macosx-10.6-intel-3.6/MySQLdb
    /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/local/Cellar/mysql/8.0.13/include/mysql -I/Users/vince/mor_env/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.macosx-10.6-intel-3.6/MySQLdb/_mysql.o
    /usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.6/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.13/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.6-intel-3.6/MySQLdb/_mysql.cpython-36m-darwin.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command '/usr/bin/clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/vince/mor_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-install-iyew72oj/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-install-iyew72oj/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/6p/l2y5y39x0fv2llyxbdyb25g00000gn/T/pip-record-6oktp750/install-record.txt --single-version-externally-managed --compile --install-headers /Users/vince/mor_env/include/site/python3.6/mysqlclient Check the logs for full command output.

enter image description here

pipenter image description here

1 个答案:

答案 0 :(得分:0)

解决方案1:尝试升级您的pip版本,然后安装mysqlclient。 解决方案2:尝试安装openssl,然后安装mysqlclient。