从.pyo文件导入.pyd文件(作为python模块)时出错 [英] Error importing a .pyd file (as a python module) from a .pyo file

查看:1207
本文介绍了从.pyo文件导入.pyd文件(作为python模块)时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows上运行pygame(适用于Python).我有一些.pyo文件和一些.pyd文件.我在其他地方尝试导入另一个脚本,该脚本试图将一个.pyd文件作为模块导入,但我不断收到错误消息,指出不存在此类模块.

I am running pygame (for Python) on Windows. I have some .pyo files and some .pyd files. I have another script for somewhere else that is trying to import one of the .pyd files as a module but I keep getting the error that no such module exists.

.pyo文件在将.pyd文件作为模块导入时是否存在问题?我该怎么办才能解决这个问题?

Do .pyo files have issues importing .pyd files as modules? What can I do to solve this issue?

推荐答案

通常是由于以下一个或多个原因:

It's typically because of one or more of the following:

  • .pyd不在您当前的路径中(您说它在同一个文件夹中,所以应该不成问题)
  • .pyd依赖的DLL不在您当前的路径中.使用depends.exe或其现代的重写,然后将这些dll复制到同一文件夹或将包含目录添加到您的系统路径中
  • 您正在使用python的调试版本.然后必须将该模块从xyz.pyd重命名为xyz_d.pyd.
  • The .pyd is not in your current path (you said it was in the same folder so that should not be the problem)
  • A DLL the .pyd depends on is not in your current path. Locate the missing DLL's using depends.exe or its modern rewrite and either copy these dll's to the same folder or add the containing directories to your system path
  • You're using a debug version of python. Then the module must be renamed from xyz.pyd to xyz_d.pyd.

这篇关于从.pyo文件导入.pyd文件(作为python模块)时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆