无法在Python中安装lap==0.4.0库。

huangapple go评论78阅读模式
英文:

unable to install lap==0.4.0 library in python

问题

我试图安装用于目标检测的LAP,但无法成功。

我尝试在Python版本9、10和11上安装它,但都无法成功。

我正在从Murtaza的工作坊 - 机器人和人工智能中学习目标检测。

或者有没有办法解决这个问题?

错误信息如下:

收集 lap==0.4.0
使用缓存的 lap-0.4.0.tar.gz (1.5 MB)
准备元数据 (setup.py): 开始
准备元数据 (setup.py): 完成,状态为 'done'
构建 lap 的 wheel
构建 lap 的 wheel (setup.py): 开始
构建 lap 的 wheel (setup.py): 完成,状态为 'error'
运行 setup.py clean for lap
无法构建 lap
正在安装已收集的软件包:lap
运行 setup.py install for lap: 开始
运行 setup.py install for lap: 完成,状态为 'error'

错误:subprocess-exited-with-error

python setup.py bdist_wheel 未成功运行。
退出代码:1

[输出的 39 行内容]
在构建过程中部分导入 lap。
C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\setup.py:223: DeprecationWarning:

`numpy.distutils` 自 NumPy 1.23.0 起已不再推荐使用,因为 `distutils` 本身已不再推荐使用。对于 Python >= 3.12,它将被删除。对于较旧的 Python 版本,它将继续存在。建议对于这些 Python 版本使用 `setuptools < 60.0`。
有关更多详细信息,请参阅:
https://numpy.org/devdocs/reference/distutils_status_migration.html


from numpy.distutils.core import setup
生成 cython 文件
运行 bdist_wheel
运行 build
运行 config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
运行 config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
运行 build_src
INFO: build_src
INFO: 正在构建扩展 "lap._lapjv" 的源代码
INFO: 正在构建 data_files 源代码
INFO: build_src: 正在构建 npy-pkg 配置文件
运行 build_py
创建 build
创建 build\lib.win-amd64-cpython-39
创建 build\lib.win-amd64-cpython-39\lap
复制 lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
复制 lap\__init__.py -> build\lib.win-amd64-cpython-39\lap
运行 build_ext
INFO: numpy.distutils._msvccompiler 模块中没有名为 'numpy.distutils._msvccompiler' 的模块;尝试从 distutils 中导入
INFO: 定制 MSVCCompiler
INFO: 使用 build_ext 定制 MSVCCompiler
INFO: CCompilerOpt.cc_test_flags[1077] : 测试标志 (/O2)
错误:需要 Microsoft Visual C++ 14.0 或更高版本。请使用 "Microsoft C++ Build Tools" 获取它:https://visualstudio.microsoft.com/visual-cpp-build-tools/
INFO: CCompilerOpt.cache_flush[857] : 将缓存写入路径 -> C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\build\temp.win-amd64-cpython-39\Release\ccompiler_opt_cache_ext.py
[输出的 39 行内容]

注意:此错误源自子进程,可能与 pip 无关。
错误:lap 构建 wheel 时失败
错误:subprocess-exited-with-error

运行 setup.py install for lap 未成功运行。
退出代码:1

[输出的 39 行内容]
在构建过程中部分导入 lap。
C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\setup.py:223: DeprecationWarning:

`numpy.distutils` 自 NumPy 1.23.0 起已不再推荐使用,因为 `distutils` 本身已不再推荐使用。对于 Python >= 3.12,它将被删除。对于较旧的 Python 版本,它将继续存在。建议对于这些 Python 版本使用 `setuptools < 60.0`。
有关更多详细信息,请参阅:
https://numpy.org/devdocs/reference/distutils_status_migration.html


from numpy.distutils.core import setup
生成 cython 文件
运行 install
C:\Users\ACER\Desktop\Object-Detection-Yolo\venv39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
运行 build
运行 config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
运行 config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
运行 build_src
INFO: build_src
INFO: 正在构建扩展 "lap._lapjv" 的源代码
INFO: 正在构建 data_files 源代码
INFO: build_src: 正在构建 npy-pkg 配置文件
运行 build_py
创建 build
创建 build\lib.win-amd64-cpython-39
创建 build\lib.win-amd64-cpython-39\lap
复制 lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
复制 lap\__init__.py -> build\lib.win-amd64-cpython-39\lap
运行 build_ext
INFO: numpy.distutils._msvccompiler 模块中没有名为 'numpy.distutils._msvccompiler' 的模块;尝试从 distutils 中导入
INFO: 定制 MSVCCompiler
INFO: 使用 build_ext 定制 MSVCCompiler
INFO: CCompilerOpt.cc_test_flags[

<details>
<summary>英文:</summary>

I was trying to install lap for object detection but i cloud not do it.


I have try to installed it on python version 9 , 10 and 11 also but i cant do it

I am learning object detection from
Murtaza&#39;s Workshop - Robotics and AI.

or is  there any way to fix this problem

    C:\\Users\\ACER\\Desktop\\Object-Detection-Yolo\\venv39\\Scripts\\activate.bat
    pip install lap==0.4.0

the error:

Collecting lap==0.4.0
Using cached lap-0.4.0.tar.gz (1.5 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: lap
Building wheel for lap (setup.py): started
Building wheel for lap (setup.py): finished with status 'error'
Running setup.py clean for lap
Failed to build lap
Installing collected packages: lap
Running setup.py install for lap: started
Running setup.py install for lap: finished with status 'error'

error: subprocess-exited-with-error

python setup.py bdist_wheel did not run successfully.
exit code: 1

[39 lines of output]
Partial import of lap during the build process.
C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\setup.py:223: DeprecationWarning:

`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python &gt;= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools &lt; 60.0` for those Python versions.
For more details, see:
  https://numpy.org/devdocs/reference/distutils_status_migration.html


from numpy.distutils.core import setup

Generating cython files
running bdist_wheel
running build
running config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
INFO: build_src
INFO: building extension "lap.lapjv" sources
INFO: building data_files sources
INFO: build_src: building npy-pkg config files
C:\Users\ACER\Desktop\Object-Detection-Yolo\venv39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: 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-cpython-39
creating build\lib.win-amd64-cpython-39\lap
copying lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
copying lap_init
.py -> build\lib.win-amd64-cpython-39\lap
running build_ext
INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
INFO: customize MSVCCompiler
INFO: customize MSVCCompiler using build_ext
INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (/O2)
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\build\temp.win-amd64-cpython-39\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
error: subprocess-exited-with-error

Running setup.py install for lap did not run successfully.
exit code: 1

[39 lines of output]
Partial import of lap during the build process.
C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\setup.py:223: DeprecationWarning:

`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python &gt;= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools &lt; 60.0` for those Python versions.
For more details, see:
  https://numpy.org/devdocs/reference/distutils_status_migration.html


from numpy.distutils.core import setup

Generating cython files
running install
C:\Users\ACER\Desktop\Object-Detection-Yolo\venv39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
INFO: build_src
INFO: building extension "lap.lapjv" sources
INFO: building data_files sources
INFO: build_src: building npy-pkg config files
running build_py
creating build
creating build\lib.win-amd64-cpython-39
creating build\lib.win-amd64-cpython-39\lap
copying lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
copying lap_init
.py -> build\lib.win-amd64-cpython-39\lap
running build_ext
INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
INFO: customize MSVCCompiler
INFO: customize MSVCCompiler using build_ext
INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (/O2)
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\ACER\AppData\Local\Temp\pip-install-a82najcq\lap_e14dabff97d544e59d3633db1f44d15e\build\temp.win-amd64-cpython-39\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.

[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip






</details>


# 答案1
**得分**: 1

安装适合您计算机版本的 Microsoft Visual C++ Build Tools。这可能有助于解决问题并升级 "pip"。

链接:https://visualstudio.microsoft.com/visual-cpp-build-tools/

然后运行以下命令升级 "pip":

```python -m pip install --upgrade pip```

之后,再尝试安装 lap 版本 0.4.0:

```pip install lap==0.4.0```

<details>
<summary>英文:</summary>

Install Microsoft Visual C++ Build Tools with  appropriate version for your computer. This might help about this and upgrade &quot;pip&quot;

```https://visualstudio.microsoft.com/visual-cpp-build-tools/```

```python -m pip install --upgrade pip```

and after this, try again with:

```pip install lap==0.4.0```


</details>



huangapple
  • 本文由 发表于 2023年6月13日 17:55:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463707.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定