ModuleNotFoundError: No module named ‘lap‘ 已解决

 常规操作,直接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

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值