我正在嘗試在沒有 GPU 的 64 位 Windows 10 計算機上使用 Anaconda Python 中的 Keras(我不知道這是否重要)。我打電話pip install keras,似乎安裝順利。但是調用import keras會出現此錯誤: Traceback (most recent call last): File "C:\Users\jsmith\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\jsmith\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\jsmith\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 "C:\Users\jsmith\anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\jsmith\anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec)ImportError: DLL load failed: The specified module could not be found.During handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\jsmith\anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module> from tensorflow.keras.layers.experimental.preprocessing import RandomRotation File "C:\Users\jsmith\anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module> from tensorflow.python.tools import module_util as _module_util File "C:\Users\jsmith\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\jsmith\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module> raise ImportError(msg)所以我去安裝 tensorflow 使用pip install tensorflow. 似乎需要一段時間,雖然最終它安裝了,但沒有解決我的問題,仍然給我上述錯誤。
2 回答

翻閱古今
TA貢獻1780條經驗 獲得超5個贊
根據tensorflow installation,您應該已經為 Windows 7 或更高版本預安裝了C++ 可再發行組件。
然后你可以做
pip?install?path_t_wheel_file.whl
我聽說 Visual Studio 是一個非常大的程序,我不想安裝它。
您不必安裝整個 visual studio 只需安裝C++ 可再發行組件
使 TensorFlow 工作的 Visual Studio 是什么,
我沒有查看 tensorflow 的源代碼,但我認為它是用它編寫的,C++
因此它需要由 C++ 可再發行組件提供的額外庫

眼眸繁星
TA貢獻1873條經驗 獲得超9個贊
這可能有助于
創建新環境,不要在基本環境中安裝包(可選,但它為我修復了 tensorflow 安裝錯誤)
conda install -c conda-forge tensorflow
然后安裝tensorflowpip install keras
或conda install -c conda-forge keras
添加回答
舉報
0/150
提交
取消