常规操作,直接pip install lap,出现如下报错信息
Collecting lap
Downloading lap-0.4.0.tar.gz (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 1.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Building wheels for collected packages: lap
Building wheel for lap (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
Partial import of lap during the build process.
Generating cython files
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
options
running build_src
build_src
building extension "lap._lapjv" sources
building data_files sources
build_src: building npy-pkg config files
C:\Users\HP\anaconda3\lib\site-packages\setuptools\command\install.py:34: Se
tuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and
other standards-based tools.
warnings.warn(
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\lap
copying lap\lapmod.py -> build\lib.win-amd64-3.8\lap
copying lap\__init__.py -> build\lib.win-amd64-3.8\lap
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying f
rom distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
CCompilerOpt.cc_test_flags[1013] : testing flags (/O2)
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Micros
oft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
CCompilerOpt.cache_flush[809] : write cache to path -> C:\Users\HP\AppData\L
ocal\Temp\pip-install-777j3m49\lap_4ddbc6bcd3c84fffadc6f1fed26f7595\build\temp.win
-amd64-3.8\Release\ccompiler_opt_cache_ext.py
[end of output]
note: This error originates from a subprocess, and is likely not a problem with
pip.
ERROR: Failed building wheel for lap
Running setup.py clean for lap
Failed to build lap
Installing collected packages: lap
Running setup.py install for lap ... error
error: subprocess-exited-with-error
× Running setup.py install for lap did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
Partial import of lap during the build process.
Generating cython files
running install
C:\Users\HP\anaconda3\lib\site-packages\setuptools\command\install.py:34: Se
tuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and
other standards-based tools.
warnings.warn(
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
options
running build_src
build_src
building extension "lap._lapjv" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\lap
copying lap\lapmod.py -> build\lib.win-amd64-3.8\lap
copying lap\__init__.py -> build\lib.win-amd64-3.8\lap
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying f
rom distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
CCompilerOpt.cc_test_flags[1013] : testing flags (/O2)
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Micros
oft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
CCompilerOpt.cache_flush[809] : write cache to path -> C:\Users\HP\AppData\L
ocal\Temp\pip-install-777j3m49\lap_4ddbc6bcd3c84fffadc6f1fed26f7595\build\temp.win
-amd64-3.8\Release\ccompiler_opt_cache_ext.py
[end of output]
note: This error originates from a subprocess, and is likely not a problem with
pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lap
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
解决方法:
不用pip,用conda安装
conda install -c conda-forge lap
或者还可以在github上拉取
pip install git+git://github.com/gatagat/lap.git