locust安装后报错:ImportError: DLL load failed while importing _greenlet: 找不到指定的模块。

发布时间 2023-04-14 10:36:29作者: 蹇爱黄

需要安装msvc-runtime

pip install msvc-runtime

这个问题很神奇,因为别人没有,按照官网上的介绍python3使用 pip3 install locust就可以使用了,但是我的运行脚本就报错。

为什么会出现这个问题可以参考matplotlib

vscode 在导入 matplotlib.pyplot 的时候。matplotlib报错: ImportError: DLL load failed: 找不到指定的模块。查了好多资料,都没有办法解决问题。最终在 github 那里找到答案。matplotlib 3.3 以上的版本。需要安装一个msvc-runtime 的依赖包。办法如下:pip install msvc-runtime
具体原理是:msvc-runtime 提供了很多 dll 文件,其实就是微软的 Visual C++ 的运行环境。对于使用 VC++ 开发的软件应用,在运行时必须有这个dll才可以。 matplotlib windows版本里用到的一些 dll 是使用VC开发的,所以必须安装这个库。