python应用运行时报错,部分提示信息如下:
Traceback (most recent call last):
File “D:\*\gridencoder\grid.py”, line 10, in
import _gridencoder as _backend
ModuleNotFoundError: No module named ‘_gridencoder’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
……
File “*\gridencoder\backend.py”, line 28, in
raise RuntimeError(“Could not locate a supported Microsoft Visual C++ installation”)
RuntimeError: Could not locate a supported Microsoft Visual C++ installation
这个错误表明应用在加载 _gridencoder
模块时失败了,原因是无法找到 Microsoft Visual C++ 编译器(cl.exe
),跟另一篇文章问题是一样的《python应用报错ModuleNotFoundError: No module named ‘_raymarching_face’》,
解决方法:
先看电脑上是否安装了VS 【使用C++的桌面开发】,然后再到gridencoder目录下修改setup.py和backend.py中cl.exe的实际路径地址,然后重新运行setup编译即可,
具体步骤可以查看这篇文章《python应用报错ModuleNotFoundError: No module named ‘_raymarching_face’》