简体   繁体   中英

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.

    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. Thanks

Error might be because you have installed Tensorflow-probability in env and not activated while importing package. Follow the steps to install Tensorflow and 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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