Rust 安装diesel 报mysqlclient错误

操作系统:Windows 64;操作环境:rust

导致问题操作:cargo install diesel_cli (安装diesel)

问题截图:

Rust 安装diesel 报mysqlclient错误

解决:cargo install diesel_cli --no-default-features --features mysql(参考https://blog.****.net/m0_37696990/article/details/107140872)

附:安装mysqlclient

为什么安装安装diesel需要mysqlclient:

diesel操作mysql,实际上底层还是通过python来操作的,所以首先需要python环境,再者需要安装python环境中驱动程序(本文安装mysqlclient)

安装python:

可参考-> https://zhuanlan.zhihu.com/p/43155342

由于安装mysqlclient需要用到pip,在此注意检查pip有没有安装好哦,命令行输入pip

注:由于我的pip没安装好(异常: pip 不是内部或外部命令),继续参考:https://blog.****.net/qingfengxd1/article/details/91884140

注:由于我的pip没安装好(异常:ModuleNotFoundError: No module named 'pip),继续参考:
https://blog.****.net/haihonga/article/details/100168691

命令行输入pip有非异常信息表示安装好了

安装mysqlclient:

下载安装文件:
文件地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient ctrl+f搜索mysqlclient ,下载自己python版本以及电脑对应系统的安装文件(本文下载mysqlclient-1.4.6-cp38-cp38-win32.whl)
安装:cmd进到mysqlclient文件存放位置执行命令:pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
安装成功截图:(pip list:查看是否成功安装mysqlclient)
Rust 安装diesel 报mysqlclient错误
注:出现错误(表示.whl文件的版本没有下载对应,查看自己python版本以及电脑系统)
Rust 安装diesel 报mysqlclient错误