我尝试安装 keras 但出现错误。 我还安装了轮子。 我也无法安装tensorflow。 python setup.py bdist_wheel 没有运行成功。
我也有同样的问题。这是我得到的:
pip 安装 keras
Collecting keras
Using cached keras-3.0.1-py3-none-any.whl.metadata (4.8 kB)
Collecting absl-py (from keras)
Using cached absl_py-2.0.0-py3-none-any.whl.metadata (2.3 kB)
Requirement already satisfied: numpy in c:\users\samoni\appdata\local\programs\python\python312\lib\site-packages (from keras) (1.26.2)
Collecting rich (from keras)
Using cached rich-13.7.0-py3-none-any.whl.metadata (18 kB)
Collecting namex (from keras)
Using cached namex-0.0.7-py3-none-any.whl (5.8 kB)
Collecting h5py (from keras)
Using cached h5py-3.10.0-cp312-cp312-win_amd64.whl.metadata (2.5 kB)
Collecting dm-tree (from keras)
Using cached dm-tree-0.1.8.tar.gz (35 kB)
Preparing metadata (setup.py) ... done
Collecting markdown-it-py>=2.2.0 (from rich->keras)
Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich->keras)
Using cached pygments-2.17.2-py3-none-any.whl.metadata (2.6 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich->keras)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Using cached keras-3.0.1-py3-none-any.whl (999 kB)
Using cached absl_py-2.0.0-py3-none-any.whl (130 kB)
Using cached h5py-3.10.0-cp312-cp312-win_amd64.whl (2.7 MB)
Using cached rich-13.7.0-py3-none-any.whl (240 kB)
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Using cached pygments-2.17.2-py3-none-any.whl (1.2 MB)
Building wheels for collected packages: dm-tree
Building wheel for dm-tree (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [70 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-312
creating build\lib.win-amd64-cpython-312\tree
copying tree\sequence.py -> build\lib.win-amd64-cpython-312\tree
copying tree\tree_benchmark.py -> build\lib.win-amd64-cpython-312\tree
copying tree\tree_test.py -> build\lib.win-amd64-cpython-312\tree
copying tree\__init__.py -> build\lib.win-amd64-cpython-312\tree
running build_ext
cmake version 3.28.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Found CMake
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:4 (project):
Running
'nmake' '-?'
failed with:
no such file or directory
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Samoni\AppData\Local\Temp\pip-install-hwk_xmq8\dm-tree_4cacfd9246c141d5bba3844e34deb4ae\setup.py", line 124, in <module>
setuptools.setup(
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\dist.py", line 963, in run_command
super().run_command(command)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
self.run_command("build")
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\dist.py", line 963, in run_command
super().run_command(command)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
self.run_command(cmd_name)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\dist.py", line 963, in run_command
super().run_command(command)
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Samoni\AppData\Local\Temp\pip-install-hwk_xmq8\dm-tree_4cacfd9246c141d5bba3844e34deb4ae\setup.py", line 72, in run
self.build_extension(ext)
File "C:\Users\Samoni\AppData\Local\Temp\pip-install-hwk_xmq8\dm-tree_4cacfd9246c141d5bba3844e34deb4ae\setup.py", line 108, in build_extension
subprocess.check_call(
File "C:\Users\Samoni\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Samoni\\AppData\\Local\\Temp\\pip-install-hwk_xmq8\\dm-tree_4cacfd9246c141d5bba3844e34deb4ae\\tree', '-DPython3_ROOT_DIR=C:\\Users\\Samoni\\AppData\\Local\\Programs\\Python\\Python312', '-DPython3_EXECUTABLE=C:\\Users\\Samoni\\AppData\\Local\\Programs\\Python\\Python312\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Samoni\\AppData\\Local\\Temp\\pip-install-hwk_xmq8\\dm-tree_4cacfd9246c141d5bba3844e34deb4ae\\build\\lib.win-amd64-cpython-312', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dm-tree
Running setup.py clean for dm-tree
Failed to build dm-tree
ERROR: Could not build wheels for dm-tree, which is required to install pyproject.toml-based project