python调用动态库:

OSError: [WinError 126] 找不到指定的模块

解决方法:把当前目录添加到系统中:

要添加目标文件的父目录:

current_dir结尾不带'/',注意,后面接..是不对的,应该接'/../abc'

import sys
import threading
import time

current_dir = os.path.abspath(os.path.dirname(__file__))
print(current_dir)
sys.path.append(current_dir)

解决方法1:把依赖项目录添加到系统环境变量中。

解决方法2:

current_dir = os.path.abspath(os.path.dirname(__file__))
os.chdir(current_dir)
cv_dll=CDLL(r"hik_client.dll")
os.chdir(current_dir+"/..")

这个是最简单demo:os.chdir('D:\\ge\\testDLL\\x64\\Debug\\')

参考:https://blog.csdn.net/u012505618/article/details/81047988

OSError: [WinError 126] 找不到指定的模块相关推荐

  1. OSError: [WinError 126] 找不到指定的模块/Could not find 'cudart64_90.dll'.

    OSError: [WinError 126] 找不到指定的模块/Could not find 'cudart64_90.dll'. 原文:http://blog.csdn.net/wobeatit/ ...

  2. OSError: [WinError 126] 找不到指定的模块————Shapely

    问题 OSError: [WinError 126] 找不到指定的模块----Shapely pip install shapely之后,跑程序报错误,错误如下:import shapely 没问题, ...

  3. python打包不能在其他电脑打开、找不到指定模块,pyinstaller打包移植到别的电脑报错OSError: [WinError 126] 找不到指定的模块。...

    首先说一下我的环境 win10 python3.6.4 下面是我安装库 版本 pip list Package         Version --------------- ------------ ...

  4. OSError: [WinError 126] 找不到指定的模块。【专治疑难杂症】

    OSError: [WinError 126] 找不到指定的模块. Error loading "D:\xxxxxxx\lib\site-packages\torch\lib\asmjit. ...

  5. OSError: [WinError 126] 找不到指定的模块。

    OSError: [WinError 126] 找不到指定的模块. 参考博客:https://www.pianshen.com/article/90841683243/ 环境:Win10+Anacon ...

  6. OSError: [WinError 126] 找不到指定的模块Errorloading“torch\lib\caffe2_nvrtc.dll“ or one of its dependencies.

    import torch x = torch.empty(5, 3) print(x) 报错 D:\Anaconda\anaconda3\python.exe D:/Python1自学/pythonP ...

  7. 解决Pytorch:raise err OSError: [WinError 126] 找不到指定的模块caffe2_detectron_ops.dll” or one of its dependen

    解决Pytorch:raise err OSError: [WinError 126] 找不到指定的模块 caffe2_detectron_ops.dll" or one of its de ...

  8. OSError: [WinError 126] 找不到指定的模块。 Error loading “G:\anaconda\lib\site-packages\torch\lib\caffe2_dete

    OSError: [WinError 126] 找不到指定的模块. Error loading "G:\anaconda\lib\site-packages\torch\lib\caffe2 ...

  9. 完美解决 OSError: [WinError 126] 找不到指定的模块

    OSError: [WinError 126] 找不到指定的模块 问题: 遇到这个问题 大多数都是 缺少了 dll 今天在python中遇到了 OSError: [WinError 126] 找不到指 ...

最新文章

  1. Chapter12:动态内存
  2. pycharm python脚本自动头文件注释
  3. java 泛型解耦,T-MVP:泛型深度解耦下的MVP大瘦身
  4. C++ :vector的使用
  5. wxWidgets:设备上下文
  6. 计算机专业学习资料总结(~持续更新中)
  7. 前端学习(1117):严格模式的变化
  8. android 多个按钮响应,处理Android Recyclerview中的多个按钮单击并将响应存储在Array或ArrayList中...
  9. C#中结构体排序方法(Array.sort() + ICompare)
  10. pku 2387 Til the Cows Come Home
  11. 如何通过XMind 实践OKR 工作法
  12. cNode------路由设置以及项目基本框架搭建
  13. 文件服务器 共享 端口,共享文件服务端口设置
  14. Anaconda中spyder5闪退如何解决
  15. poj 2454 随机化(划片使得选举胜利)
  16. Java高级程序设计课程设计报告
  17. CityMaker研修之路 02 伟景行(CityMaker)的倾斜之路
  18. 钉钉通知-调用钉钉发送企业内部消息开发
  19. Vmware虚拟机安装Linux系统(cent OS 7 64)
  20. 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理解决方案

热门文章

  1. socket 与 vfs
  2. 微软资深软件工程师:阅读代码真的很难
  3. CDN监控系统(三 业务架构)
  4. Python 在定义函数时 为什么默认参数不能放在必选参数前面
  5. java解惑你知道多少_Java解惑
  6. 杭州java班学费多少_杭州学java费用多少
  7. openapi开放平台架构_适用于所有人的MicroProfile OpenAPI
  8. css出现的问题以及解决,div+css的浮动常出现的问题以及解决办法_html/css_WEB-ITnose...
  9. 在 M1 芯片 Mac 中使用原生 Java 优雅地玩 Minecraft
  10. 说实话,Intellij IDEA 自带的 Vim 插件真心不错!