You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TensorFlow导入ctypes时出现‘模块未找到’错误的解决求助

问题:导入_ctypes时DLL加载失败的排查与解决

为深入理解机器学习在多人游戏中的应用,我研究了SIMPLE项目。由于项目版本较旧,我更新了依赖包,requirements.txt内容如下:

pytorch==2.0.1
pytorch-cuda==11.8
tensorflow==2.10.0
stable-baselines3==1.5.0
jupyter==1.0.0
jupyterlab==4.0.2
pillow
mpi4py==3.1.4

通过conda创建Python3.10环境并安装所有依赖后,PyCharm未提示任何错误,但运行命令train.py -r -e sushigo时立即报错:

C:\workspace\SIMPLE\app\train.py -r -e sushigo 
Traceback (most recent call last):
  File "C:\workspace\SIMPLE\app\train.py", line 6, in <module>
    import tensorflow as tf
  File "E:\anaconda3\envs\SIMPLE\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "E:\anaconda3\envs\SIMPLE\lib\site-packages\tensorflow\python\__init__.py", line 24, in <module>
    import ctypes
  File "E:\anaconda3\envs\SIMPLE\lib\ctypes\__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.

我已尝试以下操作,但问题始终存在:

  • 重新安装所有依赖包
  • 彻底卸载并重装Anaconda
  • 仅安装前4个核心依赖,排除版本冲突可能性

系统信息:

  • Windows 10(64位)
  • Python 3.10.8
  • conda 23.5.0
  • PyCharm 2023.1.3(社区版)

求该错误的原因及可行解决方法。

内容的提问来源于stack exchange,提问作者pbuchheit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 08:02:49