宝塔服务器部署Django提示mysqlclient未安装 ,宝塔libmariadb安装教程

第一次在debian系统中使用django5.0以上版本,遇到这个问题,也是和AI切磋了好久也没有解决,然后跟着CSDN一个贴子捣鼓了一下成功了,然后又找了一个debian12的服务器纯用CSDN的方法不好使,我就将AI的前期交流找了点有用的出来,暂时先做记录,后续有机会详细整理
debian系统我们也不熟悉,大家看着捣鼓吧。
sudo apt-get install apt-listchanges -y --no-install-recommends # 跳过交互式提示
sudo apt autoremove
sudo sed -i 's/^confirm=.*/confirm=0/' /etc/apt/listchanges.conf
sudo apt update # 刷新软件包列表
sudo apt upgrade # 升级可更新软件包
at the very top of the logical **L file to trigger sandbox mode:
/*M!999999\- enable the sandbox mode */
Newer version of MariaDB clients strip away the backslash and dash (:
升级剩余软件包
sudo apt update && sudo apt upgrade -y # 处理未升级的 97 个包 时间有点久
keep the local version currently installed 红色的 回车
root@VM-16-17-debian:/www/wwwroot/fdsa# 这样的时候说明跑完了
清理旧内核文件
sudo apt autoremove # 移除冗余的永久关闭 apt-listchanges 交互
echo 'confirm=0' | sudo tee -a /etc/apt/listchanges.conf # 禁止升级确认提示此时我们尝试重新安装mysqlclient
pip uninstall mysqlclient
pip install mysqlclient
会失败,会出现现在的结果:
exec(code, locals())
File "<string>", line 156, in <module>
File "<string>", line 49, in get_config_posix
File "<string>", line 28, in find_package_name
Exception: Can not find valid pkg-config name.
Specify MY**LCLIENT_CFLAGS and MY**LCLIENT_LDFLAGS env vars manually
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× 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.
以下debian系统可以直接用,其他系统参考Django安装mysqlclient报错_trying pkg-config --exists mysqlclient command 'pk-CSDN博客
sudo apt-get updatesudo apt-get install pkg-configsudo apt-get install libmariadb-dev-compat
或
sudo apt-get install libmariadb-dev成功后,我再现安装
pip install mysqlclient
更多文章:
现代网站favicon应该有哪些尺寸,favicon.ico需要多种尺寸来适配不同设备和平台
2026年4月2日 10:47
sitemap无静态时怎么防止恶意访问,sitemap防御方法
2026年3月9日 16:01
linux终端查看Nginx日志文件指定关键词,Nginx日志查找蜘蛛
2025年10月11日 16:37
宝塔Nginx屏蔽UA,屏蔽Referer方法,宝塔NG补充免费防火墙方法
2025年9月21日 21:29
宝塔服务器部署Django提示mysqlclient未安装 ,宝塔libmariadb安装教程
2025年5月21日 22:10














