Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pythonshell重新启动_Python_Shell_Tensorflow_Python Idle - Fatal编程技术网

pythonshell重新启动

pythonshell重新启动,python,shell,tensorflow,python-idle,Python,Shell,Tensorflow,Python Idle,Shell在不打印输出的情况下重新启动 import tensorflow as tf from tensorflow.python.client import timeline a = tf.random_normal([2000, 5000]) b = tf.random_normal([5000, 1000]) res = tf.matmul(a, b) print ('aaaaaaaaaaaaaaa') with tf.Session() as sess: #

Shell在不打印输出的情况下重新启动

import tensorflow as tf 
from tensorflow.python.client import timeline 


a = tf.random_normal([2000, 5000]) 
b = tf.random_normal([5000, 1000]) 
res = tf.matmul(a, b) 
print ('aaaaaaaaaaaaaaa')

with tf.Session() as sess:

    # add additional options to trace the session execution 
    options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)

    run_metadata = tf.RunMetadata()

    sess.run(res, options=options, run_metadata=run_metadata) 
    print ('bbbbbbbbb')

    # Create the Timeline object, and write it to a json file 
    fetched_timeline = timeline.Timeline(run_metadata.step_stats) 
    chrome_trace = fetched_timeline.generate_chrome_trace_format() 
    with open('timeline_01.json', 'w') as f: 
        f.write(chrome_trace) 
Python idle不打印输出,但始终打印:

================== RESTART: C:\Users\hirplk\Desktop\test.py ==================
aaaaaaaaaaaaaaa

=============================== RESTART: Shell ===============================

每当我运行任何代码时都会发生这种情况。这有什么特别的问题吗?这是在我最近多次安装tensorflow之后发生的

我相当确信,cpython bugs.python.org跟踪器上没有关于空闲shell在不应该重新启动时(调试器未使用时)重新启动的问题。我也不知道最近有人问过这样的问题

您似乎启动了IDLE,编辑了C:\Users\hirplk\Desktop\test.py,并通过点击F5或单击菜单项来运行它。正常情况下,IDLE开始在新的用户代码进程中执行代码,与IDLE接口进程分离。您的代码打印了“a”字符串,该字符串在空闲进程中出现在Shell窗口中。在此之后,b字符串打印之前的一个tensorflow调用使用户进程崩溃。当空闲进程与用户进程失去通信时,它将重新启动交互式Shell。这是故意的

如果IDLE已安装且功能正常,查看
RESTART:Shell
行的唯一其他方法是从菜单中显式选择
RESTART Shell

要确定空闲安装是否是问题所在,请在不涉及空闲安装的情况下从命令行运行代码。例如,在命令提示窗口中输入
py C:\Users\hirplk\Desktop\test.py


“每当我运行任何代码时都会发生这种情况。”您的意思是如果您输入“print('Hello')”`在编辑器、保存和运行中,您会看到重新启动行而不做任何操作?如果是这样,您可能有一个需要修复的错误安装,或者可能有一个我从未使用过的旧版本的Python/IDLE需要更换。您使用的是什么版本的Python/IDLE?

如果您要绑定C,我只想对一个旧问题提出一点意见++代码到Python库(Boo.python或pybDun11),然后像C++中的SeEx错那样的异常异常导致了<代码>重启:shell < /C> >。