【问题标题】:tf.VERSION is always 1.6.0 even though I installed the latest version即使我安装了最新版本,tf.VERSION 始终为 1.6.0
【发布时间】:2018-04-18 04:17:38
【问题描述】:

请帮我解决问题 - 我使用谷歌的 Colaboratory 运行 tensor_hub 示例 使用 TF-Hub 进行文本分类,它需要 1.7.0 之后的版本,但我安装的版本是 1.8.0。

# Install the latest Tensorflow version.
!pip install --quiet "tensorflow>=1.7"
# Install TF-Hub.
!pip install tensorflow-hub

import tensorflow as tf
import tensorflow_hub as hub
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import re
import seaborn as sns



RuntimeErrorTraceback (most recent call last) <ipython-input-20-48e1bdaa8642> in <module>()
      1 import tensorflow as tf
----> 2 import tensorflow_hub as hub
      3 import matplotlib.pyplot as plt
      4 import numpy as np
      5 import os

/usr/local/lib/python2.7/dist-packages/tensorflow_hub/__init__.py in <module>()
     63 
     64 # Comment/uncomment to skip checking the TensorFlow version.
---> 65 _check_tensorflow_version(tf.VERSION)
     66 
     67 # Used by doc generation script.

/usr/local/lib/python2.7/dist-packages/tensorflow_hub/__init__.py in
_check_tensorflow_version(version)
     60       "TensorFlow Hub depends on 'tf-nightly' build after %s or "
     61       "'tensorflow~=%s'. Found tf.VERSION = %s" % (
---> 62           _NIGHTLY_VERSION, _MAIN_VERSION, version))
     63 
     64 # Comment/uncomment to skip checking the TensorFlow version.

RuntimeError: TensorFlow Hub depends on 'tf-nightly' build after 20180308 or 'tensorflow~=1.7'. Found tf.VERSION = 1.6.0

【问题讨论】:

    标签: tensorflow google-colaboratory


    【解决方案1】:

    好消息:TF 1.7 现在默认可用。 :)

    您遇到的根本问题是 python 将加载的模块缓存在 sys.modules 中——正如 Korakot 所指出的,在您重新启动该过程之前,重新导入模块不会获取新版本。

    【讨论】:

      【解决方案2】:

      您可能需要重新启动运行时。

      menu &gt; Runtime &gt; Restart runtime...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-04-29
        • 2021-09-13
        • 2022-12-05
        • 2021-01-27
        • 1970-01-01
        • 1970-01-01
        • 2020-04-22
        相关资源
        最近更新 更多