gpt4 book ai didi

python - 在 Mac 上安装 mysqlclient 时出错

转载 作者:行者123 更新时间:2023-12-03 20:45:48 25 4
gpt4 key购买 nike

我正在尝试在 macOS BigSur(在 M1 芯片 mac 上运行)上安装 mysqlclient 作为使用 MySQL DB 实现 django 项目的一部分。但是,我收到以下错误:

Collecting mysqlclient
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-install-73_o12ze/mysqlclient_23e4f763c971433c863260eda891b9d0/setup.py'"'"'; __file__='"'"'/private/var/folders/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-install-73_o12ze/mysqlclient_23e4f763c971433c863260eda891b9d0/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/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-record-jl3d35rj/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/mysqlclient
cwd: /private/var/folders/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-install-73_o12ze/mysqlclient_23e4f763c971433c863260eda891b9d0/
Complete output (41 lines):
mysql_config --version
['8.0.22']
mysql_config --libs
['-L/usr/local/mysql/lib', '-lmysqlclient', '-lssl', '-lcrypto', '-lresolv']
mysql_config --cflags
['-I/usr/local/mysql/include']
ext_options:
library_dirs: ['/usr/local/mysql/lib']
libraries: ['mysqlclient', 'resolv']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/local/mysql/include']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.9/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/MySQLdb
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/opt/openssl@1.1/include -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.9/MySQLdb/_mysql.o -std=c99
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-install-73_o12ze/mysqlclient_23e4f763c971433c863260eda891b9d0/setup.py'"'"'; __file__='"'"'/private/var/folders/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-install-73_o12ze/mysqlclient_23e4f763c971433c863260eda891b9d0/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/rs/vv5212l55ys7lk0vx4p87gxw0000gn/T/pip-record-jl3d35rj/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/mysqlclient Check the logs for full command output.
请注意,我已经检查了为同一问题打开的许多问题。但是没有一个建议的修复对我有用。
请帮忙

最佳答案

这个问题现在对我来说是固定的,为此我做了两件事:
1 - 安装的车轮包

pip3 install wheel
2 - 我关注了这个帖子 - Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

关于python - 在 Mac 上安装 mysqlclient 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65754976/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com