gpt4 book ai didi

python : Failing to install scikit-learn (error code 1) on widows

转载 作者:太空宇宙 更新时间:2023-11-03 20:03:48 27 4
gpt4 key购买 nike

我按照sklearn官方网站上的说明进行操作,即使满足要求,我仍然无法安装sklearn。这是我收到的错误消息:

ERROR: Command errored out with exit status 1:
command: 'd:\others\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anath\\AppData\\Local\\Temp\\pip-install-dnha64ok\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\anath\\AppData\\Local\\Temp\\pip-install-dnha64ok\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\anath\AppData\Local\Temp\pip-record-s7idmuvg\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\
Complete output (44 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
Traceback (most recent call last):
File "d:\others\python\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\setup.py", line 290, in <module>
setup_package()
File "C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\setup.py", line 286, in setup_package
setup(**metadata)
File "d:\others\python\lib\site-packages\numpy\distutils\core.py", line 137, in setup
config = configuration()
File "C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\setup.py", line 174, in configuration
config.add_subpackage('sklearn')
File "d:\others\python\lib\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "d:\others\python\lib\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage
config = self._get_configuration_from_setup_py(
File "d:\others\python\lib\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearn\setup.py", line 76, in configuration
maybe_cythonize_extensions(top_path, config)
File "C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\sklearn\_build_utils\__init__.py", line 42, in maybe_cythonize_extensions
with_openmp = check_openmp_support()
File "C:\Users\anath\AppData\Local\Temp\pip-install-dnha64ok\scikit-learn\sklearn\_build_utils\openmp_helpers.py", line 83, in check_openmp_support
ccompiler.compile(['test_openmp.c'], output_dir='objects',
File "d:\others\python\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "d:\others\python\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "d:\others\python\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "d:\others\python\lib\site-packages\setuptools\msvc.py", line 843, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "d:\others\python\lib\site-packages\setuptools\msvc.py", line 485, in __init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
available_vc_ver
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anath\\AppData\\Local\\Temp\\pip-installpip-install-dnha64ok\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\anath\AppData\Local\Temp\pip-record-s7idmuvg\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

numpy 好像有问题,但我已经更新到最新版本了。我使用的是 Windows 10,使用 Python 3.7,并且 numpy/scipy 是最新的。提前致谢!

最佳答案

将你的python升级到3.8,因为3.9.0也有这个安装问题。

关于 python : Failing to install scikit-learn (error code 1) on widows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59081406/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com