—— 阿尔伯特·爱因斯坦

程序员の奇妙冒险

PythonPython
2025-10-10 14:16阅读:71评论:0

解决Mac Python 安装mysqlclient失败

执行pip install mysqlclient或poetry add mysqlclient安装mysqlclient时提示安装失败,提示如下 需要安装mysql-client 安装mysql-client 执行brew install mysql-client命令安装,安装成功后会提示如下 需

  • 执行___PROTECTED_5__0___PROTECTED_6__3___PROTECTED_7__1___PROTECTED_8__4___PROTECTED_9__2__时提示安装失败,提示如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Collecting mysqlclient
Downloading mysqlclient-2.2.7.tar.gz (91 kB)
91.4/91.4 kB 672.9 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
exit code: 1
> [31 lines of output]
Trying pkg-config --exists mysqlclient
Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
Trying pkg-config --exists mariadb
Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
Trying pkg-config --exists libmariadb
Command 'pkg-config --exists libmariadb' returned non-zero exit status 1.
Trying pkg-config --exists perconaserverclient
Command 'pkg-config --exists perconaserverclient' returned non-zero exit status 1.
Traceback (most recent call last):
 
  • 需要安装___PROTECTED_5__0___PROTECTED_6__3___PROTECTED_7__2___PROTECTED_8__4___PROTECTED_9__1__命令安装,安装成功后会提示如下
1
2
3
4
5
6
7
8
9
10
11
12
==> Caveats
==> mysql-client
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because it conflicts with mysql (which contains client libraries).
 
If you need to have mysql-client first in your PATH, run:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
 
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
export CPPFLAGS="-I/usr/local/opt/mysql-client/include"
 
  • 需要在___PROTECTED_11__0___PROTECTED_12__6___PROTECTED_13__1___PROTECTED_14__7___PROTECTED_15__2___PROTECTED_16__8___PROTECTED_17__3___PROTECTED_18__9___PROTECTED_19__4___PROTECTED_20__10___PROTECTED_21__5__安装命令即可安装成功
评论(0)
暂无评论来抢沙发吧~