亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

導入錯誤: 無法導入名稱“我的圖書館”

導入錯誤: 無法導入名稱“我的圖書館”

海綿寶寶撒 2022-09-27 10:38:37
我看了一個教程,該教程是用Python編寫的關于OpenCV的。當我嘗試導入類時遇到錯誤。錯誤如下。 Traceback (most recent call last):  File "webstreaming.py", line 1, in <module>    from pyimagesearch.motion_detection import SingleMotionDetectorImportError: cannot import name 'SingleMotionDetector' from 'pyimagesearch.motion_detection' (/home/pi/Desktop/Denemeler/pyimagesearch/motion_detection/__init__.py)這是我的目錄樹。.├── pyimagesearch│   ├── __init__.py│   └── motion_detection│       ├── __init__.py│       └── singlemotiondetector.py├── templates│   └── index.html└── webstreaming.py我檢查了堆棧溢出,但沒有一個答案對我有用。謝謝。
查看完整描述

1 回答

?
慕標5832272

TA貢獻1966條經驗 獲得超4個贊

導入常規包時,將隱式執行此 init.py 文件,并且它定義的對象將綁定到包的命名空間中的名稱。

由于沒有模塊導入,因此我們必須從相應的文件中手動導入所需的子模型。 在 中,導入應如下所示__init__.pySingleMotionDetectorsinglemotiondetector.py

from pyimagesearch.motion_detection.singlemotiondetector import SingleMotionDetector

參考 : 蟒蛇包


查看完整回答
反對 回復 2022-09-27
  • 1 回答
  • 0 關注
  • 105 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號