简体   繁体   English

没有名为“tensorflow_probability”的模块

[英]No module named 'tensorflow_probability'

I need to use Tensorflow and Tensorflow_Probability.我需要使用 Tensorflow 和 Tensorflow_Probability。 After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook:通过以下命令conda install tensorflow-probabilitypip install --upgrade tensorflow-probability ,我在笔记本中运行它:

import tensorflow_probability as tfp

but it returns this error:但它返回此错误:

    ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-41494c8c96ff> in <module>
----> 1 import tensorflow_probability as tfp

ModuleNotFoundError: No module named 'tensorflow_probability'.

The results of结果

pip list

is as below (related parts):如下(相关部分):

tblib                              1.3.2
tensorboard                        1.13.1
tensorflow                         1.13.1
tensorflow-estimator               1.13.0
tensorflow-probability             0.7.0
termcolor                          1.1.0
terminado                          0.8.1
testpath                           0.4.2
tfp-nightly                        0.8.0.dev20190708
Theano                             1.0.4
toolz                              0.9.0

Can anyone help me to solve this problem (I am using Win 10)?谁能帮我解决这个问题(我使用的是 Win 10)?

Your versions are correct and your command is correct too.你的版本是正确的,你的命令也是正确的。

Seems like inconsistency in other module is causing this.似乎其他模块中的不一致导致了这种情况。

run the following commands and try again:运行以下命令并重试:

pip install -U dm-sonnet==1.23
pip install --upgrade tfp-nightly

References: https://github.com/deepmind/graph_nets/issues/3 https://github.com/tensorflow/probability/issues/103参考资料: https : //github.com/deepmind/graph_nets/issues/3 https://github.com/tensorflow/probability/issues/103

tensorflow-probability 0.7.0 is not compatible with: tensorflow 1.13.1 check the tensoflow-probability version release page https://github.com/tensorflow/probability/releases tensorflow-probability 0.7.0 不兼容:tensorflow 1.13.1 检查 tensoflow-probability 版本发布页面https://github.com/tensorflow/probability/releases

Correct solution will be either to upgrade tensorflow to 1.14.0 or downgrade tensorflow-probability to 0.6.0正确的解决方案是将 tensorflow 升级到 1.14.0 或将 tensorflow-probability 降级到 0.6.0

pip install -U tensorflow-probability==0.6.0

如上一个答案,您必须通过此页面找到与您的 TensorFlow 版本兼容的版本: https : //github.com/tensorflow/probability/releases

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

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