简体   繁体   中英

How can I fix this error in python 3.8 pycharm? It is about importing packages

This is the error it gives me when I try to run it:

Traceback (most recent call last):
  File "/Users/kids/Library/Mail/V5/E60CBF1C-9021-4A10-8D60-06C96C141AF1/Outbox.mbox/E7C72E99-E3DB-4CDC-B1C9-15116F3478D8/Data/Attachments/405/2/ASL-Finger-Spelling-Recognition-master/main.py", line 10, in <module>
    from keras.layers.convolutional import Convolution3D, MaxPooling3D

This is the code error which it is showing:

from keras.layers.convolutional import Convolution3D, MaxPooling3D

Keras version is 2.3.1. Python version is Python 3.8. Running on MacOS.

Your import statement

from keras.layers.convolutional import Convolution3D, MaxPooling3D

attempts to import MaxPooling3D from keras.layers.convolutional . MaxPooling3D is actually part of the pooling module, ie keras.layers.pooling .

According to the keras source and docs , the best way to import these two classes in a single statement would be

from keras.layers import Convolution3D, MaxPooling3D

Alternatively, you could import them separately:

from keras.layers.convolutional import Convolution3D
from keras.layers.pooling import MaxPooling3D

but in general, you should pay attention to what is purposefully exposed via the package; that is, the classes accessible from keras.layers .

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