網站首頁 編程語言 正文
No Module named ***問題
問題描述
使用python的時候,老是遇見No Module named的問題,例如在使用TensorFlow Object Detection API的過程中(GitHub:DetectionAPI),過程中的問題
1)protc編譯失敗
2)object_detection模塊導入錯誤
from object_detection.builders import model_builder
from object_detection.meta_architectures import faster_rcnn_meta_arch
from object_detection.meta_architectures import rfcn_meta_arch
from object_detection.meta_architectures import ssd_meta_arch
from object_detection.models import ssd_resnet_v1_fpn_feature_extractor as ssd_resnet_v1_fpn
from object_detection.protos import hyperparams_pb2
from object_detection.protos import losses_pb2
from object_detection.protos import model_pb2
對于問題1,采用3.3版本的protoc進行編譯,注意在research目錄下面編譯
對于問題2(書中的參考模塊是slim,路徑:/home/lxl/models-master/research/slim,pwd:/home/lxl/models-master/research)
export PYTHONPATH=$PYTHONPATH:'pwd':'pwd'/slim
該命令執(zhí)行完以后,可以在research目錄python環(huán)境中導入slim模塊,但是換一個目錄就無法導入了!
也就是python環(huán)境變量在當前目錄下work on,對于object_detection目錄也是如此(export PYTHONPATH=$PYTHONPATH:‘pwd’:‘pwd’/object_detection),如何修改python全部的環(huán)境變量,使得在任
何終端路徑下面都可以導入module呢?
這時候我們需要配置~/.bashrc文件
sudo gedit ~/.bashrc
export PYTHONPATH=$PYTHONPATH:'/home/lxl/models-master/research'
在打開終端,直接導入模塊就OK(slim 和object_detection都在research目錄下面)
python3 No module named 'PIL'
在python3,scrapy框架已經安裝好的情況下,還是出現了:
python3 No module named 'PIL'
在Python3下,PIL已經被Pillow替代了,所以只需要安裝Pillow就可以了
使用命令
pip3 install Pillow?
可能中途會一直安裝不上去,就跟下圖的報紅的一樣(多半是連接超時),
這時候我們需要做的就是多安裝幾次,用的還是:
pip3 install Pillow
安裝完成之后,重新運行程序,就沒問題了
原文鏈接:https://blog.csdn.net/miss_future/article/details/98388999
相關推薦
- 2022-09-06 C語言用函數指針實現一個特別的計算器_C 語言
- 2022-06-28 ES6基礎語法之數組拓展_基礎知識
- 2022-09-16 Linux?Shell如何用ssh命令統(tǒng)計分布式集群信息詳解_linux shell
- 2022-04-24 解決redis在linux上的部署的問題_Redis
- 2022-07-22 React警告:Can‘t perform a React state update on an u
- 2022-12-10 Qt顯示QImage圖像在label上,并保持自適應大小問題_C 語言
- 2022-09-18 Go語言實現文件上傳_Golang
- 2022-06-02 python文件與路徑操作神器?pathlib_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發(fā)現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支