I have installed libaries with pip but still get errors while importing them.
ModuleNotFoundError Traceback (most recent call last)
Cell In [1], line 2
1 import random
—-> 2 import keras
3 import tensorflow as tf
4 import pandas as pd
ModuleNotFoundError: No module named ‘keras’
2
Answers
Typically this result from multiple python installations on a machine.
When you use the
pip install <package>
a different python on your machine installed the package, than the python which is used if you execute your program.I would recommend to work with virtual environment to have a "individual" python for every project on your machine.
https://docs.python.org/3/library/venv.html
This may be caused by the inconsistency between your environment and the pip installation path.
When you use the conda environment, you can use the
conda install keras
command to install.