我已经安装了一个keras,但是当我在python3中运行代码时,出现错误。
以下是代码:
import tensorflow as tf
from skimage.transform import resize
from keras import backend as K
,并且错误显示:
Using TensorFlow backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site-packages\keras\__init__.py", line 3, in <module> from . import utils
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site packages\keras\utils\__init__.py", line 25, in <module> from .training_utils import multi_gpu_model
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site packages\keras\utils\training_utils.py", line 1, in <module> from ..layers.merge import concatenate
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site-packages\keras\layers\__init__.py", line 4, in <module> from ..engine import Layer
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site-packages\keras\engine\__init__.py", line 3, in <module> from .topology import InputSpec
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site-packages\keras\engine\topology.py", line 8, in <module> import yaml
File "C:\Users\AzUm\Anaconda3\envs\opencv-env\lib\site-packages\yaml\__init__.py", line 2, in <module> from error import *
ModuleNotFoundError: No module named 'error'
答案 0 :(得分:0)
要解决上述问题,您可以使用此链接https://github.com/yaml/pyyaml
如果未找到setup.py,请提供设置setup.py的路径
C:\ Users \ AzUm \ Downloads \ pyyaml-master> python setup.py安装