i have installed "Anaconda3-2020.07-Windows-x86_64" and python "python-3.8.0". after that, i have installed keras and then tensorflow. but each time i am running the code " import keras " in spyder, the problem is showing that:
***Traceback (most recent call last):
File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Asus\anaconda3\lib\site-packages\keras_ init _.py", line 3, in from tensorflow.keras.layers.experimental.preprocessing import RandomRotation File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow_ init _.py", line 41, in
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python_ init _.py", line 40, in
from tensorflow.python.eager import context
File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\context.py", line 35, in
from tensorflow.python import pywrap_tfe
File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in raise ImportError(msg)
ImportError: Traceback (most recent call last): File "C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in
import keras
File "C:\Users\Asus\anaconda3\lib\site-packages\keras_ init _.py", line 5, in raise ImportError( ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow
----------------------------------------------***
now, i dont know what is the problem mainly. because my tensorflow version shows that its 2.3.0.. i dont know what iis the problem. please, any one help.
From comments
I had to create a environment in anaconda, named the environment as tensorflow, and created the environment based on python 3.6. In that environment, i imported tensorflow, keras separately and installed the spyder, jupyter notebook. after all these steps, it worked (paraphrased from kazi fahim lateef)
Steps to create virtual environment in anaconda
# Create environment
conda create --name TF
# When conda asks you to proceed, type y:
proceed ([y]/n)?
# Activate virtual environment
conda activate TF
# Install the TF Version
conda install tensorflow
# Install the Keras Version
conda install Keras
Note: From TF 2.0, onwards keras are integrated with TF. You can refer tf.keras module for more details.
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.