python - 无法导入 ctypes - 架构不匹配?
问题描述
我在 64 位版本的 Windows 10 上使用 64 位版本的 python 来运行一些代码。但是,代码在导入 ctypes 时失败。实际上,该问题的最小示例很简单:
import ctypes
这里失败了:
from _ctypes import Union, Structure, Array
出现此错误:
DLL load failed: %1 is not a valid Win32 application
仔细阅读,这似乎是将 32 位 dll 加载到 64 位版本的 python 中的问题(反之亦然,但我的 python 版本是 64 位,所以......)。但是,我不明白的是,ctypes似乎是与python捆绑在一起的东西,即它是在我安装python时安装的。ctypes 本身的架构是否错误?如果它带有 64 位版本的 Python,那怎么可能呢?
解决方案
推荐阅读
- python - 如何通过将 Label 小部件转换为 Canvas 小部件在 TKinter 中使背景透明?
- php - PHP 的 echo/print_r 函数能否以某种方式打印 NULL 和 false 之类的单词?
- matlab - 低通滤波器设计matlab
- javascript - 如何抓取没有 href 且在页面源中不可用的链接
- node.js - React-Hooks PUT 在单击时从对象请求特定字段
- javascript - 如何缩短vue-apex图表中x轴标签之间的空间
- python - 如何从预配置的日志记录对象中获取配置字典
- python - 我在 else 中不断收到语法错误 - 如果用户输入错误,则需要帮助 Python 创建矢量计算器
- mysql - 当我尝试加入 NULLS 时,MySQL 查询返回一个非常错误的结果
- sql - SQL 中两个时间间隔之间的条件是否需要更好?