简体   繁体   English

安装时没有名为“tensorflow_probability”的模块

[英]No module named 'tensorflow_probability' when it's installed

I am having the same issue as many others and their solutions haven't worked.我和其他许多人有同样的问题,他们的解决方案没有奏效。

Im using tensorflow 2.2.0 and tensorflow probability 0.10.0.我使用 tensorflow 2.2.0 和 tensorflow 概率 0.10.0。

    Package                Version
---------------------- ---------
absl-py                0.11.0
astunparse             1.6.3
cachetools             4.2.0
certifi                2020.12.5
chardet                4.0.0
cloudpickle            1.6.0
decorator              4.4.2
dm-tree                0.1.5
gast                   0.3.3
google-auth            1.24.0
google-auth-oauthlib   0.4.2
google-pasta           0.2.0
grpcio                 1.34.0
h5py                   2.10.0
idna                   2.10
importlib-metadata     3.3.0
Keras                  2.4.3
Keras-Preprocessing    1.1.2
Markdown               3.3.3
numpy                  1.19.5
oauthlib               3.1.0
opt-einsum             3.3.0
pip                    20.3.3
protobuf               3.14.0
pyasn1                 0.4.8
pyasn1-modules         0.2.8
PySimpleGUI            4.33.0
PyYAML                 5.3.1
requests               2.25.1
requests-oauthlib      1.3.0
rsa                    4.6
scipy                  1.4.1
setuptools             47.1.0
six                    1.15.0
tensorboard            2.2.2
tensorboard-plugin-wit 1.7.0
tensorflow             2.2.0
tensorflow-estimator   2.2.0
tensorflow-probability 0.10.0
termcolor              1.1.0
typing-extensions      3.7.4.3
urllib3                1.26.2
Werkzeug               1.0.1
wheel                  0.36.2
wrapt                  1.12.1
zipp                   3.4.0

After running my code运行我的代码后

import tensorflow_probability as tfp

the system gives me error系统给了我错误

ModuleNotFoundError: No module named 'tensorflow_probability'

I looked at 0.10.0 is stable with tf 2.2.0, so I'm confused as to what the issue is.我看了看 0.10.0 在 tf 2.2.0 上是稳定的,所以我对问题所在感到困惑。 Thanks谢谢

Error might be because you have installed Tensorflow-probability in env and not activated while importing package.错误可能是因为您在 env 中安装了Tensorflow-probability ,但在导入 package 时未激活。 Follow the steps to install Tensorflow and Tensorflow-probability.按照步骤安装 Tensorflow 和 Tensorflow-probability。

#Create the virtual environment
python -m venv tf 
#Activate tf env
source env/bin/activate
#Install Tensorflow and Tensorflow-probability
pip install tensorflow==2.2
pip install tensorflow-probability==0.10.0

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

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