ubuntu 绘制lenet网络结构图遇到的问题汇总

本文详细介绍了如何解决Python中pydot模块的导入问题,并通过安装特定版本的pyparsing及pydot来确保能够正常加载dot文件,最终实现使用Caffe绘制神经网络结构图。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Couldn't import dot_parser, loading of dot files will not be possible的问题

1 .sudo pip uninstall pyparsing

2. sudo pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709

 

    writing dependency_links to pyparsing.egg-info/dependency_links.txt
    writing manifest file 'pyparsing.egg-info/SOURCES.txt'
    reading manifest file 'pyparsing.egg-info/SOURCES.txt'
    writing manifest file 'pyparsing.egg-info/SOURCES.txt'
    Copying pyparsing.egg-info to /usr/local/lib/python2.7/dist-packages/pyparsing-1.5.7-py2.7.egg-info
    running install_scripts
    writing list of installed files to '/tmp/pip-58Jx3A-record/install-record.txt'
done
  Removing source in /tmp/pip-I3FlLc-build
Successfully installed pyparsing-1.5.7
Cleaning up...

 

3. sudo pip install pydot

The directory '/home/tina/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/tina/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pydot in /usr/lib/python2.7/dist-packages

 

进入python文件夹:cd ./caffe/python

   使用draw_net.py绘制lenet网络结构图

      命令:python draw_net.py ../examples/mnist/lenet_train_test.prototxt lenet.png

      如果出现错误:ImportError: No module named pydot,则再次使用pip安装,pip install pydot

      再次运行:python draw_net.py ../examples/mnist/lenet_train_test.prototxt lenet.png

      如果出现错误了:pydot.InvocationException: GraphViz's executables not found,此时需要安装graphviz,命令为sudo apt-get install graphviz

      最后再运行一次,终于成功了。在python文件夹下得到lenet.png文件了。如下图:

     

 

转载于:https://www.cnblogs.com/is-Tina/p/7694298.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值