Мой список окружений :
- Python 3.7 в Windows 10
pip установил тензор потока от Анаконды.
Моя версия тензор-потока - тензор-1.13.1
Я установил keras и opencv-python с помощью командной строки Anaconda.
(pip install xxx).
Вот мой код:
import os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
import glob
import cv2
from sklearn.model_selection import train_test_split
from keras.layers import Dropout,Dense
from keras.models import Sequential,load_model
from keras.layers.normalization import BatchNormalization
from keras.applications import VGG16
from sklearn.metrics import accuracy_score,confusion_matrix
human_expression=glob.glob("E:/expression/sad/*");
print("number of images in sad emotion:"+str(len(human_expression)));
Когда я использовал PyCharm для написания некоторых кодов Python. Я не могу правильно построить проект.
Проблемы ниже:
Using TensorFlow backend. Traceback (most recent call last): File
"D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\Anaconda3\lib\imp.py", line 242, in
load_module
return load_dynamic(name, filename, file) File "D:\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec) ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "E:/PythonProject/Test.py",
line 10, in <module>
from keras.layers import Dropout,Dense File "D:\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in
<module>
from . import utils File "D:\Anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in
<module>
from . import conv_utils File "D:\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in
<module>
from .. import backend as K File "D:\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 89,
in <module>
from .tensorflow_backend import * File "D:\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py",
line 5, in <module>
import tensorflow as tf File "D:\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in
<module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File
"D:\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line
49, in <module>
from tensorflow.python import pywrap_tensorflow File "D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 74, in <module>
raise ImportError(msg) ImportError: Traceback (most recent call last): File
"D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "D:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\Anaconda3\lib\imp.py", line 242, in
load_module
return load_dynamic(name, filename, file) File "D:\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec) ImportError: DLL load failed: 找不到指定的模块。
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.
Process finished with exit code 1