{"id":553974,"date":"2022-02-04T13:25:17","date_gmt":"2022-02-04T05:25:17","guid":{"rendered":"http:\/\/4563.org\/?p=553974"},"modified":"2022-02-04T13:25:17","modified_gmt":"2022-02-04T05:25:17","slug":"%e5%85%b3%e4%ba%8e-opencvcuda-%e5%9c%a8-win11-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85-3","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=553974","title":{"rendered":"\u5173\u4e8e OpenCV+CUDA \u5728 Win11 \u7f16\u8bd1\u5b89\u88c5"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1> \u5173\u4e8e OpenCV+CUDA \u5728 Win11 \u7f16\u8bd1\u5b89\u88c5 <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <span><i><\/i> 35<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u73af\u5883\u63cf\u8ff0 CPU 5800x \uff0cGPU 750Ti \uff0cCUDA 11.5 \uff0cWin11 \uff0cOpenCV4.5.4 \u5f04\u4e86\u597d\u51e0\u5929\u4e86\uff0c\u4e0d\u592a\u786e\u5b9a\u662f\u4e0d\u662f win11 \u7684\u95ee\u9898\uff0c\u7f16\u8bd1\u662f\u90fd\u901a\u8fc7\u4e86\uff0c\u4f46\u662f cv2 \u5305\u5bfc\u5165\u4e0d\u6210\u529f\uff0c\u786e\u5b9e\u5bf9 win \u6ca1\u5565\u7ecf\u9a8c\uff0c\u4e0d\u77e5\u9053\u6709\u6ca1 CV \u7684\u5927\u4f6c\u5e2e\u52a9\u4e00\u4e0b\u5c0f\u5f1f<\/p>\n<pre><code>Traceback (most recent call last):   File \"&lt;stdin&gt;\", line 1, in &lt;module&gt;   File \"C:PythonPython310libsite-packagescv2__init__.py\", line 183, in &lt;module&gt;     bootstrap()   File \"C:PythonPython310libsite-packagescv2__init__.py\", line 155, in bootstrap     native_module = importlib.import_module(\"cv2\")   File \"C:PythonPython310libimportlib__init__.py\", line 126, in import_module     return _bootstrap._gcd_import(name[level:], package, level) ImportError: DLL load failed while importing cv2: \u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a21\u5757\u3002 <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>21<\/span>) <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"7112926\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hbtech <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u8bd5\u8bd5<br \/>from cv2 import cv2 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112927\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @hbtech \u8fd8\u662f\u4e00\u6837\u7684\u9519 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112928\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jakarta <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4e3b\u7684 opencv \u662f\u6309\u7167\u8fd9\u91cc\u7684\u6587\u6863\u7f16\u8bd1\u7684\u5417\uff1f https:\/\/docs.opencv.org\/4.5.4\/d5\/de5\/tutorial_py_setup_in_windows.html <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112929\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruxuan1306 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4f20\u8bf4\u5b66\u672f\u5708\u90fd\u662f ubuntu \uff0c\u8bd5\u8bd5 wsl2 \u7684 ubuntu <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112930\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysc3839 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u8bd5\u8bd5 Miniconda? <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112931\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinliming2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u63d0\u793a\u662f\u52a0\u8f7d dll \u5931\u8d25\uff0c\u5e94\u8be5\u662f\u7f16\u8bd1\u7684 dll \u6ca1\u88c5\u5230\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u4f60\u7ed9\u51fa\u7684\u9519\u8bef\u8c03\u7528\u6808\uff0c\u7b2c\u4e8c\u884c\u90a3\u4e2a\u6587\u4ef6\u7684 183 \u884c\u770b\u770b\u662f\u600e\u4e48\u52a0\u8f7d\u7684\uff0c\u770b\u770b\u80fd\u4e0d\u80fd\u5f97\u51fa\u66f4\u591a\u4fe1\u606f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112932\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @Jakarta \u6211\u662f\u6309\u7167\u8fd9\u91cc\u6765\u7684 https:\/\/towardsdatascience.com\/opencv-with-gstreamer-and-qt-on-windows-6f0fdb075993 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112933\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @ruxuan1306 \u597d\u50cf\u4e0d\u80fd\u7528 gui \uff0c\u4e0d\u592a\u786e\u5b9a <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112934\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @ysc3839 \u6211\u7814\u7a76\u7814\u7a76 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112935\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @jinliming2 \u770b\u4ee3\u7801\u4f7f\u7528`native_module = importlib.import_module(&#8220;cv2&#8221;)`\u5c31\u62a5\u9519\u4e86\uff0c\u6709\u6ca1\u6709\u4ec0\u4e48\u529e\u6cd5\u77e5\u9053\u4ed6\u52a0\u8f7d\u90a3\u4e2a dll \u5931\u8d25\u7684 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112936\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : thinkershare <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u6211\u5efa\u8bae\u4f60\u4f7f\u7528 WS2, \u4e0d\u8981\u5728 Windows \u4e0a\u6298\u817e\u673a\u5668\u5b66\u4e60, \u592a\u591a\u5e93\u53c8\u517c\u5bb9\u6027\u95ee\u9898\u4e86! <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112937\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shm7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u641e\u4e0d\u660e\u767d\uff0c\u4e3a\u5565\u90fd\u8fd9\u4e48\u559c\u6b22\u5728\u5c01\u95ed\u4e0d\u5bb9\u6613\u914d\u7f6e\u7684\u73af\u5883\u4e0b\u9762\u505a\u914d\u7f6e\uff0c\u7279\u522b\u662f\u65b0\u624b\u3002<br \/>\u6211\u5e26\u4eba\uff0c\u7b2c\u4e00\u4ef6\u4e8b\uff0c\u5c31\u662f\u653e\u5f03 Windows \u4f5c\u4e3a\u5f00\u53d1\u73af\u5883\uff0c\u6216\u8005\u4f60\u6eda\u86cb\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112938\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinliming2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u53c2\u8003\uff1a<br \/>https:\/\/github.com\/opencv\/opencv\/issues\/16500<br \/>https:\/\/github.com\/opencv\/opencv\/commit\/450b96510e2c6fd2921da1fe2893945c5234a54f<br \/>\u5e94\u8be5\u662f windows \u4e0a\u7684 python3.8+ dll \u52a0\u8f7d\u8def\u5f84\u4e0d\u8bfb\u73af\u5883\u53d8\u91cf\u4e86\u3002<br \/>\u6309\u7167 commit \u7684\u5185\u5bb9\uff0c\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf CUDA_PATH \u4e3a\u4f60 opencv \u7684\u8def\u5f84\u5373\u53ef\u3002\u5e94\u8be5\u4f1a\u81ea\u52a8\u67e5\u627e CUDA_PATH \u4e0b\u7684 bin \u76ee\u5f55\u3002<br \/>\u6216\u8005\u4f60\u6309\u7167\u4e0a\u9762\u90a3\u4e2a issue \u91cc\u8bf4\u7684\uff0c\u653e\u5230 python \u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\uff1f\uff08\u4e0d\u63a8\u8350\uff09 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112939\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinliming2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4ee4\uff1a\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u540e\u5efa\u8bae\u91cd\u542f\u7cfb\u7edf\uff0c\u7136\u540e\u5f00 powershell \u8fd0\u884c echo $env:CUDA_PATH \u6216\u8005\u5f00 cmd \u8fd0\u884c echo %CUDA_PATH% \u786e\u8ba4\u914d\u7f6e\u751f\u6548 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112940\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @shm7 \u54c8\u54c8\u8001\u54e5\u522b\u751f\u6c14\uff0c\u672c\u804c\u5de5\u4f5c\u4e0d\u662f\u505a\u89c6\u89c9\u7684\uff0c\u5de5\u4f5c\u7684\u7535\u8111\u662f\u4e2a mac \uff0c\u8fd9\u662f\u53f0\u6253\u6e38\u620f\u7684\u60f3\u5b66\u4e60\u5b66\u4e60\u8fd9\u65b9\u9762\u7684\u4e1c\u897f\u4f46\u662f\u611f\u89c9\u641e\u4e2a\u53cc\u7cfb\u7edf\u592a\u9ebb\u70e6 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112941\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @jinliming2 \u591a\u8c22\uff0c\u6211\u4e0b\u73ed\u56de\u53bb\u8bd5\u8bd5 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112942\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @thinkershare \u7814\u7a76\u4e86\u4e00\u4e0b\uff0c\u641e Xserver \u8fd8\u662f\u6709\u70b9\u9ebb\u70e6 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112943\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @jinliming2 \u6211\u53d1\u73b0\u6211\u8fd9\u4e2a\u7684 config.py \u6587\u4ef6\u5df2\u7ecf\u52a0\u4e0a\u4e86 CUDA_PATH \u7684\u8def\u5f84\u4e86 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112944\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zouri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4e0d\u6574 win11 \u4e86\uff0c\u6362\u56de win10 \uff0c\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u8f6f\u4ef6\u4e5f\u6709 bug \uff0c\u53f3\u952e\u4e5f\u53d7\u4e0d\u4e86 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112945\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruxuan1306 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @zouri #19 win11 \u7684 wsl2 \u9ed8\u8ba4\u652f\u6301 gui <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7112946\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shm7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @zouri 750Ti \u771f\u6ca1\u6709\u5fc5\u8981\u6d6a\u8d39\u65f6\u95f4\u6574\u8fd9\u4e9b\u3002\u4f60\u7528 mac \u4e5f\u4e0d\u592a\u53ef\u80fd\u5728 mac \u4e0a\u88c5 cuda \u5440\u3002\u8001\u8001\u5b9e\u5b9e CPU \u7248\u672c\u3002\u6700\u7b80\u5355\u7684\uff08\u57fa\u672c\u6ca1\u6709\u4e0d\u8fd9\u4e48\u5e72\u7684\uff09\u662f\u8fdc\u7a0b\u8fde\u63a5\u5e26 GPU \u7684\u670d\u52a1\u5668\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e OpenCV+CUDA \u5728 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/553974"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=553974"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/553974\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=553974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=553974"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=553974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}