gpt4 book ai didi

python - 无法导入 tensorflow_probability

转载 作者:行者123 更新时间:2023-12-05 03:51:39 27 4
gpt4 key购买 nike

当我尝试导入 tensorflow_probability 时,出现此错误:

Traceback (most recent call last):
File "PATH", line 1, in <module>
import tensorflow_probability
File "PATH", line 75, in <module>
from tensorflow_probability.python import * # pylint: disable=wildcard-import
File "PATH", line 24, in <module>
from tensorflow_probability.python import edward2
File "PATH", line 32, in <module>
from tensorflow_probability.python.experimental.edward2.generated_random_variables import *
File "PATH", line 34, in <module>
from tensorflow_probability.python.experimental import auto_batching
File "PATH", line 24, in <module>
from tensorflow_probability.python.experimental.auto_batching import frontend
File "PATH", line 46, in <module>
from tensorflow.python.autograph.pyct import compiler
ImportError: cannot import name 'compiler' from 'tensorflow.python.autograph.pyct' (PATH)

我不知道为什么 Python 不能导入这个模块,因为当我在 cmd 中输入 pip list 时,它告诉我我有 tensorflow-probability 0.8.0rc0 安装。任何帮助将不胜感激。

最佳答案

尝试安装 tf_agents 包。尝试导入 tensorflow_probability 时出现一些导入错误。这些包括:

  • 模块“tensorflow.python.ops.linalg.linear_operator”没有属性“make_composite_tensor”
  • 无法从“tensorflow_probability.python.internal”导入名称“all_util”

当我安装并导入 tf_agents 时,这些问题得到了解决。

pip install --upgrade tf_agents

如果您使用的是 jupyter,请将以下内容添加到单元格中,然后运行它:

import sys
!{sys.executable} -m pip install --upgrade tf_agents

关于python - 无法导入 tensorflow_probability,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62743492/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com