ImportError: DLL load failed while importing _ctypes

在python中使用pyinstaller 生成exe文件后,使用时报错:

Traceback (most recent call last):
  File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_mplconfig.py", line 45, in <module>
  File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_mplconfig.py", line 31, in _pyi_rthook
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "PyInstaller\fake-modules\_pyi_rth_utils\_win32.py", line 12, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "ctypes\__init__.py", line 8, in <module>
ImportError: DLL load failed while importing _ctypes: 找不到指定的模块。
 

解决方法:
使用everything 或 查看自己使用的anaconda虚拟环境文件夹中,找到ffi.dll:

复制一份到
所属项目的.\dist\ProjectName\_internal 中。
-----------------------------------------------------------------------------
更好的方式:
pyinstaller --onefile --add-data "F:\Anaconda3\envs\py3106\Library\bin\ffi.dll;." xx.py

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值