【发布时间】:2018-10-14 13:47:55
【问题描述】:
我是 C 语言的 Python 初学者。现在我计划使用在 Windows、Linux 和 OS X 上运行的 Python + C 库 (ctypes) 来实现一个跨平台项目,并且我已经准备好 win32.dll、win64.dll、mac_osx.so linux.so 文件。
如何通过单个 Python (.py) 文件加载它们?
我的想法是使用 Python OS 或平台模块来检查环境,像这样(抱歉这不是真正的 Python 程序):
if Windows and X86 then load win32.dll
else if Windows and X64 then load win64.dll
else if OSX then load osx.so
else if Linux then load linux.so
有没有简单明了的方法来完成这项工作?
【问题讨论】:
-
mac_osx.so?不是 .dylib?