• Ubuntu18.04 Pycharm下ModuleNotFoundError: No module named 'deeplab'


    1.根据https://www.cnblogs.com/zmbreathing/p/deeplab_v3plus.html在终端中成功运行deeplab的test文件后,在pycharm中出现问题:

    /home/mingzhou/anaconda3/bin/python3 /home/mingzhou/PycharmProjects/deeplab_model_test/deeplab_model_test.py
    Traceback (most recent call last):
    File "/home/mingzhou/PycharmProjects/deeplab_model_test/deeplab_model_test.py", line 20, in <module>
    from deeplab import common
    ModuleNotFoundError: No module named 'deeplab'

    2.根据https://blog.csdn.net/pipisorry/article/details/39909057#t9的方法一在~/.profile中设置环境变量,无效

    但在pycharm的环境变量中已经有了PYTHONPATH=/home/user/models/research/:/home/user/models/research/slim

    又发现如果使用bash pycharm.sh启动才有上述PYTHONPATH,如果直接启动则没有

    第二天直接打开pycharm也有上述PYTHONPATH,但在user的bashrc和profile均修改了PYTHONPATH,此处还是不变

    最后发现:

    用快捷方式(sh方式)启动pycharm时,无论是修改~/.bashrc中还是~/.profile中的环境变量,pycharm中显示的系统环境变量都不变
    但将电脑重新启动后,pycharm中显示的系统环境变量就会变为~/.profile中的环境变量

    用bash方式启动pycharm时,pycharm中显示的系统环境变量变为~/.bashrc中的环境变量(需要重进终端)

    3.发现conda没有安装jupyter、matplotlib、PrettyTable

    输入conda install jupyter

    conda install matplotlib

    conda install PrettyTable

    安装PrettyTable时出现错误

    根据https://blog.csdn.net/ewba_gis_rs_er/article/details/84671406成功解决此问题

    anaconda search -t conda PrettyTable

    anaconda show lightsource2-tag/prettytable

    conda install --channel https://conda.anaconda.org/lightsource2-tag prettytable

    但还是没有解决No module问题

    4.按照官方文档https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/installation.md将PYTHONPATH设为以下,即在~/.profile末尾添加

    export PYTHONPATH=$PYTHONPATH:/home/user/models/research:/home/user/models/research/slim

     出现以下错误

    若按https://www.cnblogs.com/zmbreathing/p/deeplab_v3plus.html第5点将PYTHONPATH设为

    export PYTHONPATH=$PYTHONPATH=/home/user/models/research:/home/user/models/research/slim

    会再次出现No module named 'deeplab'问题

    5.见https://www.cnblogs.com/zmbreathing/p/pycharm_cannot_import_monitoring_deeplab.html解决4中

    ImportError:cannot import name 'monitoring'问题

  • 相关阅读:
    排座椅
    关于math.h的问题
    客户调查
    排队打水
    删数游戏
    小数背包
    零件分组
    桐桐的组合
    桐桐的数学游戏
    桐桐的全排列
  • 原文地址:https://www.cnblogs.com/zmbreathing/p/pycharm_no_module_deeplab.html
Copyright © 2020-2023  润新知