我想在GPU而不是CPU上运行keras
程序。因此,我取消安装tensorflow
并成功安装了tensorflos-gpu
而不是它。但是,当我想运行程序时,会得到以下结果:
Using TensorFlow backend.
Traceback (most recent call last):
File "<ipython-input-5-22ecdcbaada4>", line 1, in <module>
runfile('C:/Users/m/Desktop/python/dollar_third.py', wdir='C:/Users/m/Desktop/python')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/m/Desktop/python/dollar_third.py", line 8, in <module>
from keras.models import Sequential
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
from .load_backend import epsilon
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\load_backend.py", line 89, in <module>
from .tensorflow_backend import *
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 6, in <module>
from tensorflow.python.framework import ops as tf_ops
ModuleNotFoundError: No module named 'tensorflow.python'
这些是我导入到程序中的模块:
from keras.models import Sequential
from keras.layers import Dense , LSTM, Bidirectional
from keras.layers import Dropout , RepeatVector , TimeDistributed , Activation
from keras import optimizers