推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
MerlinCN
V2EX  ›  Python

[Tensorflow]跑 CIFAR-10 例程的 cifar10_train.py 途中报错,求助

  •  
  •   MerlinCN · Mar 14, 2019 · 3411 views
    This topic created in 2618 days ago, the information mentioned may be changed or developed.
    Traceback (most recent call last):
    File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\pydevconsole.py", line 221, in do_exit
    import java.lang.System
    File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
    ModuleNotFoundError: No module named 'java'
    During handling of the above exception, another exception occurred:


    如上,刚刚入门,一脸懵逼
    8 replies    2019-03-14 13:32:07 +08:00
    xuwangyuan520
        1
    xuwangyuan520  
       Mar 14, 2019 via Android
    检查一下导入的模块,路径
    mscb
        2
    mscb  
       Mar 14, 2019 via Android
    py 的脚本为什么会 import Java.lang.system?
    mscb
        3
    mscb  
       Mar 14, 2019 via Android
    建议把源代码贴出来,没有上下文不好判断
    kisara
        4
    kisara  
       Mar 14, 2019 via iPhone
    虽然不知道你的代码是从哪搞的 不过目前 python 是不能执行 import Java 的
    只有 Jython 能够 import Java 但已经停止维护
    secsilm
        5
    secsilm  
       Mar 14, 2019
    看起来像是 Pycharm 的问题,建议在命令行跑,不要用 Pycharm
    dinghow
        6
    dinghow  
       Mar 14, 2019
    换用命令行跑了试一下
    MerlinCN
        7
    MerlinCN  
    OP
       Mar 14, 2019
    @secsilm
    @dinghow
    多谢各位,换命令行就没问题了,看来是 pycharm 的错
    MerlinCN
        8
    MerlinCN  
    OP
       Mar 14, 2019
    def do_exit(*args):
    '''
    We have to override the exit because calling sys.exit will only actually exit the main thread,
    and as we're in a Xml-rpc server, that won't work.
    '''

    try:
    import java.lang.System

    java.lang.System.exit(1)
    except ImportError:
    if len(args) == 1:
    os._exit(args[0])
    else:
    os._exit(0)


    "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\pydevconsole.py", line 221,源代码是这个
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3421 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 11:12 · PVG 19:12 · LAX 04:12 · JFK 07:12
    ♥ Do have faith in what you're doing.