ubuntu22.04使用pip install mysqlclient安装失败

$ pip install mysqlclient 
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      Trying pkg-config --exists mysqlclient

......

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

第一处错误有明确的提示,缺少pkg-config。解决办法:

sudo apt-get install pkg-config

第二处错误很模糊,note: This error originates from a subprocess, and is likely not a problem with pip. 多数由于依赖问题导致。

网上查一下mysqlclient安装包所有需要的依赖项,逐个测试

sudo apt-get install python3 python-dev python3-dev  -y
sudo apt-get install     build-essential libssl-dev libffi-dev -y
sudo apt-get install     libxml2-dev libxslt1-dev zlib1g-dev  -y
sudo apt-get install     python-pip -y
pip install mysqlclient

 

THE END
分享
二维码
打赏
海报
ubuntu22.04使用pip install mysqlclient安装失败
$ pip install mysqlclient × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [27 lines of output] ……
<<上一篇
下一篇>>