所以我在 Pycharm 中安装 scikit-learn 时遇到问题。这是错误代码
Collecting scikit-learn
Using cached scikit-learn-1.2.2.tar.gz (7.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [74 lines of output]
Ignoring numpy: markers 'python_version == "3.10" and platform_system == "Windows" and platform_python_implementation != "PyPy"' don't match your environment
Collecting setuptools
Using cached setuptools-67.8.0-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
Collecting Cython>=0.29.24
Using cached Cython-0.29.35-py2.py3-none-any.whl (988 kB)
Collecting oldest-supported-numpy
Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
Collecting scipy>=1.3.2
Using cached scipy-1.10.1.tar.gz (42.4 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
The Meson build system
Version: 1.1.1
Source dir: /private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f
Build dir: /private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f/.mesonpy-jflrrsl0/build
Build type: native build
Project name: SciPy
Project version: 1.10.1
C compiler for the host machine: cc (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.9)")
C linker for the host machine: cc ld64 650.9
C++ compiler for the host machine: c++ (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.9)")
C++ linker for the host machine: c++ ld64 650.9
Cython compiler for the host machine: cython (cython 0.29.35)
Host machine cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports arguments -Wno-unused-but-set-variable: NO
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Compiler for C supports arguments -Wno-incompatible-pointer-types: YES
Library m found: YES
../../meson.build:63:0: ERROR: Unknown compiler(s): [['gfortran'], ['flang'], ['nvfortran'], ['pgfortran'], ['ifort'], ['ifx'], ['g95']]
The following exception(s) were encountered:
Running `gfortran --version` gave "[Errno 2] No such file or directory: 'gfortran'"
Running `gfortran -V` gave "[Errno 2] No such file or directory: 'gfortran'"
Running `flang --version` gave "[Errno 2] No such file or directory: 'flang'"
Running `flang -V` gave "[Errno 2] No such file or directory: 'flang'"
Running `nvfortran --version` gave "[Errno 2] No such file or directory: 'nvfortran'"
Running `nvfortran -V` gave "[Errno 2] No such file or directory: 'nvfortran'"
Running `pgfortran --version` gave "[Errno 2] No such file or directory: 'pgfortran'"
Running `pgfortran -V` gave "[Errno 2] No such file or directory: 'pgfortran'"
Running `ifort --version` gave "[Errno 2] No such file or directory: 'ifort'"
Running `ifort -V` gave "[Errno 2] No such file or directory: 'ifort'"
Running `ifx --version` gave "[Errno 2] No such file or directory: 'ifx'"
Running `ifx -V` gave "[Errno 2] No such file or directory: 'ifx'"
Running `g95 --version` gave "[Errno 2] No such file or directory: 'g95'"
Running `g95 -V` gave "[Errno 2] No such file or directory: 'g95'"
A full log can be found at /private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f/.mesonpy-jflrrsl0/build/meson-logs/meson-log.txt
+ meson setup --prefix=/Library/Frameworks/Python.framework/Versions/3.11 /private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f /private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f/.mesonpy-jflrrsl0/build --native-file=/private/var/folders/c5/7bp39l255q5c7bf9j_8t2s8c0000gn/T/pip-install-sju6xn7_/scipy_bcf1716e49654d2db8011d8ebda0da5f/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
我已经完成了在 bash/terminal 中安装它的许多不同步骤,但似乎没有任何效果。我使用了brew,并且在网上找到了很多不同的代码,任何帮助将不胜感激!一切都会导致错误。我也尝试过通过pycharm手动安装,还是不行
当我创建虚拟环境并尝试从包含 scikit-learn 库的requirements.txt 文件安装软件包时,我遇到了类似的问题。如果您尚未找到解决方案,可以查看链接其中包含有关该主题的热门讨论。祝你好运!