简体   繁体   English

无法重新导入python tensorflow模块

[英]Can't re import python tensorflow module

I'm using tensorflow 1.9.0 under python 3.6. 我正在python 3.6下使用tensorflow 1.9.0。 After importing tensorflow, I can't use importlib to reload it - example: 导入tensorflow后,我无法使用importlib重新加载它-示例:

import tensorflow as tf
import importlib

importlib.reload(tf)

This crashes eventually with : 最终导致崩溃:

~/anaconda/envs/tf1pt9/lib/python3.6/site-packages/tensorflow/__init__.py in <module>()
    592 # resolution to succeed.
    593 # pylint: disable=undefined-variable
--> 594 del python
    595 del core
    596 # pylint: enable=undefined-variable

NameError: name 'python' is not defined

Isn't that weird? 那不是很奇怪吗? I guess I don't need to reload it. 我想我不需要重新加载它。

Reloading tensorflow is not supported. 不支持重新加载tensorflow。 From an issue on Github: 从Github上的一个问题:

Closing since we don't have plans to support reload anytime soon. 即将结束,因为我们没有计划在任何时候支持重新加载。

https://github.com/tensorflow/tensorflow/issues/15741 https://github.com/tensorflow/tensorflow/issues/15741

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM