使用Python import 模块时,

先会在模块的搜索path里依次搜索(前面会覆盖之后出现的同名模块),次序为:

1. 程序的主目录(交互模式下当前的工作目录或 脚本文件所在的目录)

2. 环境变量 PYTHONPATH目录(如果已经进行了设置)

3. 标准链接库目录(标准库模块所在目录 C:\Python27或C:\Python27\Lib\site-packages 目录中)

4. 任何放在标准链接库目录中的.pth文件中记录的目录

(1) 当出现诸如:

no module 错误时, 说明无法找到对应的 .pyd 文件(Python中的动态链接库文件),

其可能的原因是:

a. 该 vtkCommonPython.pyd 文件不在搜索目里。(需拷入到搜索目录下 或 将其目录设置到PYTHONPATH中)

b. 该 module的  名字有问题, 比如输错了;或 应该为Debug版(如应该为 vtkCommonPython_d.pyd, Debug版的都需在 Python_d.exe中执行,且都需加_d后缀)

(2)当出现诸如:

DLL load failed 错误时, 说明 可以找到该 模块对应的.pyd文件,但无法找到该 .pyd文件 对应的 dll文件时。

解决办法:

将对应的同名.dll文件路径放到环境变量PATH中。(或将该.dll文件放到PATH能找到的目录下)

Python import / pyd / dll的更多相关文章

  1. python import, from xx import yy

    区别: 用import modulexx/packagexx.moduleyy是导入某一模块,如果想引用模块的内容(class, method,variables...)必须用全名,即 [module ...

  2. pip install torch on windows, and the 'from torch._C import * ImportError: DLL load failed:' solution

    通过pip安装PyTorch 0.4.0成功(cpu, not gpu; python3.5; pip): pip3 install http://download.pytorch.org/whl/c ...

  3. from scipy import spatial 出现 from .qhull import * ImportError: DLL load failed: The specified module could not be found. 错误

    错误描述: 本人机器window8.1 64位,python2.7. Traceback (most recent call last): File "C:/Users/Hamid/Docu ...

  4. [源码]Python调用C# DLL例子(Python与.Net交互)

    K8Cscan C# DLL例子代码 namespace CscanDLL { public class scan { public static string run(string ip) { if ...

  5. from .cv2 import * ImportError: DLL load failed: 找不到指定的模块。 >>>

    from .cv2 import * ImportError: DLL load failed: 找不到指定的模块. >>> 昨天看项目的时候遇到这个问题,折腾到深夜,网上的各种方法 ...

  6. from _sqlite3 import * ImportError: DLL load failed: 找不到指定的模块。

    *Error creating Django application: Error on python side. Exit code: 1, err: Traceback (most recent ...

  7. python引用C++ DLL文件若干解释及示例

    python引用C++ DLL文件若干解释及示例 首先说一下,python不支持C++的DLL,但是支持C的DLL:C++因为和C兼容可以编译为C的DLL,这是下面文章的背景与前提 首先我这儿的示例使 ...

  8. python import eventlet包时提示ImportError: cannot import name eventlet

    root@zte-desktop:/home/ubuntu/python-threads# cat eventlet.py #!/usr/bin python import eventlet from ...

  9. python import 模块异常问题

    新项目开始了,(tornado,python) 结果出现了一个比较诡异的问题. import 自己的在conf文件夹下配置文件settings的时候, from conf.settings impor ...

随机推荐

  1. [Redis] C#中使用redis

    C#中使用redis 首先打开Visual Studio建立一个简单的控制台应用程序,我这里暂时使用的VS2013的版本. 然后通过Nuget进行安装Redis常用组件ServiceStack.Red ...

  2. html 新元素

    html5新元素 html5语义元素 <header> 定义了文档或者文档的一部分区域的页眉 <nav> 定义了导航链接的部分 <section> 定义了文档的某个 ...

  3. dede 最近一天发布的文章标题前加hot

    {dede:list pagesize ='15'} <!-- 模板1 --> <div class="news_list tp_a setp1"> < ...

  4. xceed wpf datagrid

    <!--*********************************************************************************** Extended ...

  5. 根据CreateDirectory递归创建多级目录

    分为MFC下的和非MFC下的两种,MFC路径是CString类型的,非MFC的路径是wstring类型的. 下面是MFC下的创建目录: void __fastcall RecursiveDirecto ...

  6. Linq查询IEnumerable与IQueryable

    class Program { static void Main(string[] args) { System.Diagnostics.Stopwatch stp = new Stopwatch() ...

  7. 一个中型项目:本地校园App

    好暨: 这个项目的起源于课堂老师作业的要求.老师要求一年下来完成一个构想并实现Demo.思考良久,在要提交构想的那个晚上,想到了校园App,当时团队只有两个人,但我感觉到:就是它了!项目启动时间——2 ...

  8. VS2010 release 和 debug 调试区别

    VC下Debug和Release区别 最近写代码过程中,发现 Debug 下运行正常,Release 下就会出现问题,百思不得其解,而Release 下又无法进行调试,于是只能采用printf方式逐步 ...

  9. Android获取相册图片

    1. AlertDialog的使用 2. 显示和隐式意图的区别 3. 相册页面的跳转 4. 选择完成后返回图片的获取 ----------------------------------------- ...

  10. JQuery树形目录制作

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DT ...