win10环境下python安装cython-bbox模块出错的解决

2023-10-20 11:10

本文主要是介绍win10环境下python安装cython-bbox模块出错的解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、现象描述

在win10  python3.10 环境下安装cython-bbox,用pip install cython-bbox出现无法安装的问题,报错如下图:

报错文字:

Processing c:\users\administrator\cython_bbox-0.1.3.tar.gz
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: cython-bbox
  Building wheel for cython-bbox (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'cython_bbox' extension
      creating build
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      creating build\temp.win-amd64-cpython-310\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site
-packages\numpy\core\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019
\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\
include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/cython_bbox.c /Fobuild\temp.win-amd64-cpython-310\Rele
ase\src/cython_bbox.obj -Wno-cpp
      cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cython-bbox
  Running setup.py clean for cython-bbox
Failed to build cython-bbox
ERROR: Could not build wheels for cython-bbox, which is required to install pyproject.toml-based projects

 错误主要出现在: ERROR: Failed building wheel for cython-bbox,翻译出来就是构建cython-bbox失败。

分析原因:语句提示:     Preparing metadata (setup.py) ... done 

                                        cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”

打开 setup.py文件,内容如下:

ext_modules = [Extension(name='cython_bbox',sources=['src/cython_bbox.pyx'],extra_compile_args = [-Wno-cpp],include_dirs=[numpy_include])

经过查询资料,将extra_compile_args = [-Wno-cpp] 语句改换为 extra_compile_args = {'gcc': ['/Qstd=c99']}。如下:

ext_modules = [Extension(name='cython_bbox',sources=['src/cython_bbox.pyx'],extra_compile_args = {'gcc': ['/Qstd=c99']},include_dirs=[numpy_include])

保存退出,重新安装,仍然不行。于是:

二、安装步骤

1.下载cython-bbox包:

pip download -i https://pypi.tuna.tsinghua.edu.cn/simple cython_bbox 

# 下载cython-bbox模块
pip download -i https://pypi.tuna.tsinghua.edu.cn/simple cython_bbox

2.解压后找到setup.py,更改前面的语句。

extra_compile_args = [-Wno-cpp],    改为:extra_compile_args = {'gcc': ['/Qstd=c99']},

3.下载dev-cpp并安装

下载地址:https://download.csdn.net/download/qq_58168857/88152647?spm=1001.2014.3001.5501

4.在cmd或powershell中,进入cython-bbox文件夹

cd C:\Users\Administrator\cython_bbox-0.1.3

在cython_ccox-0.13目录下,

5. 输入以下命令进行安装

python setup.py build_ext install

一般情况下,都能正确安装 了。安装结果如下:

PS C:\Users\Administrator\cython_bbox-0.1.3> python setup.py build_ext install
Compiling src/cython_bbox.pyx because it changed.
[1/1] Cythonizing src/cython_bbox.pyx
C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\Cython\Compiler\Main.py:381: FutureW
arning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: C:\Users\Administrator\cython_bbox-0.1.3\src\cython_bbox.pyxtree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'cython_bbox' extension
creating build
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packa
ges\numpy\core\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Build
Tools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\includ
e\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/cython_bbox.c /Fobuild\temp.win-amd64-cpython-310\Release\sr
c/cython_bbox.obj gcc
cl: 命令行 warning D9024 :无法识别的源文件类型“gcc”,假定为对象文件
cl: 命令行 warning D9027 :源文件“gcc”被忽略
cython_bbox.c
C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1
_7_API_VERSION
src/cython_bbox.c(4280): warning C4244: “=”: 从“npy_intp”转换到“unsigned int”,可能丢失数据
src/cython_bbox.c(4290): warning C4244: “=”: 从“npy_intp”转换到“unsigned int”,可能丢失数据
creating C:\Users\Administrator\cython_bbox-0.1.3\build\lib.win-amd64-cpython-310
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\Administrator\AppData\L
ocal\Programs\Python\Python310\libs /LIBPATH:C:\Users\Administrator\AppData\Local\Programs\Python\Python310 /LIBPATH:C:\Users\Administrator\AppData\Local\Programs\Python\Python310\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Mi
crosoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64" /EXPOR
T:PyInit_cython_bbox build\temp.win-amd64-cpython-310\Release\src/cython_bbox.obj /OUT:build\lib.win-amd64-cpython-310\cython_bbox.cp310-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-310\Release\src\cython_bbox.cp310-win_amd
64.lib正在创建库 build\temp.win-amd64-cpython-310\Release\src\cython_bbox.cp310-win_amd64.lib 和对象 build\temp.win-amd64-cpython-310\Release\src\cython_bbox.cp310-win_amd64.exp
正在生成代码
已完成代码的生成
running install
C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!********************************************************************************Please avoid running ``setup.py`` directly.Instead, use pypa/build, pypa/installer or otherstandards-based tools.See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.********************************************************************************!!self.initialize_options()
C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!********************************************************************************Please avoid running ``setup.py`` and ``easy_install``.Instead, use pypa/build, pypa/installer or otherstandards-based tools.See https://github.com/pypa/setuptools/issues/917 for details.********************************************************************************!!self.initialize_options()
running bdist_egg
running egg_info
writing cython_bbox.egg-info\PKG-INFO
writing dependency_links to cython_bbox.egg-info\dependency_links.txt
writing top-level names to cython_bbox.egg-info\top_level.txt
reading manifest file 'cython_bbox.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'cython_bbox.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-cpython-310\cython_bbox.cp310-win_amd64.pyd -> build\bdist.win-amd64\egg
creating stub loader for cython_bbox.cp310-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\cython_bbox.py to cython_bbox.cpython-310.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying cython_bbox.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.cython_bbox.cpython-310: module references __file__
creating dist
creating 'dist\cython_bbox-0.1.3-py3.10-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing cython_bbox-0.1.3-py3.10-win-amd64.egg
creating c:\users\administrator\appdata\local\programs\python\python310\lib\site-packages\cython_bbox-0.1.3-py3.10-win-amd64.egg
Extracting cython_bbox-0.1.3-py3.10-win-amd64.egg to c:\users\administrator\appdata\local\programs\python\python310\lib\site-packages
Adding cython-bbox 0.1.3 to easy-install.pth fileInstalled c:\users\administrator\appdata\local\programs\python\python310\lib\site-packages\cython_bbox-0.1.3-py3.10-win-amd64.egg
Processing dependencies for cython-bbox==0.1.3
Finished processing dependencies for cython-bbox==0.1.3

6.检模块包安装情况

pip list

三、注意事项

1.python 版本最好高于3.8,到www.python.org下载并安装原生python包。

2. 安装cyphon-bbox前,记得先安装cython,(pip install cython),这个是安装cython-bbox的另一个前置条件。

3.安装 cython-bbox时,注意所选默认python的版本(安装目录)。

这篇关于win10环境下python安装cython-bbox模块出错的解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/246722

相关文章

解决java.lang.NullPointerException问题(空指针异常)

《解决java.lang.NullPointerException问题(空指针异常)》本文详细介绍了Java中的NullPointerException异常及其常见原因,包括对象引用为null、数组元... 目录Java.lang.NullPointerException(空指针异常)NullPointer

Node.js net模块的使用示例

《Node.jsnet模块的使用示例》本文主要介绍了Node.jsnet模块的使用示例,net模块支持TCP通信,处理TCP连接和数据传输,具有一定的参考价值,感兴趣的可以了解一下... 目录简介引入 net 模块核心概念TCP (传输控制协议)Socket服务器TCP 服务器创建基本服务器服务器配置选项服

mac安装nvm(node.js)多版本管理实践步骤

《mac安装nvm(node.js)多版本管理实践步骤》:本文主要介绍mac安装nvm(node.js)多版本管理的相关资料,NVM是一个用于管理多个Node.js版本的命令行工具,它允许开发者在... 目录NVM功能简介MAC安装实践一、下载nvm二、安装nvm三、安装node.js总结NVM功能简介N

Android开发中gradle下载缓慢的问题级解决方法

《Android开发中gradle下载缓慢的问题级解决方法》本文介绍了解决Android开发中Gradle下载缓慢问题的几种方法,本文给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧... 目录一、网络环境优化二、Gradle版本与配置优化三、其他优化措施针对android开发中Gradle下载缓慢的问

Python中常用的四种取整方式分享

《Python中常用的四种取整方式分享》在数据处理和数值计算中,取整操作是非常常见的需求,Python提供了多种取整方式,本文为大家整理了四种常用的方法,希望对大家有所帮助... 目录引言向零取整(Truncate)向下取整(Floor)向上取整(Ceil)四舍五入(Round)四种取整方式的对比综合示例应

python 3.8 的anaconda下载方法

《python3.8的anaconda下载方法》本文详细介绍了如何下载和安装带有Python3.8的Anaconda发行版,包括Anaconda简介、下载步骤、安装指南以及验证安装结果,此外,还介... 目录python3.8 版本的 Anaconda 下载与安装指南一、Anaconda 简介二、下载 An

Python自动化处理手机验证码

《Python自动化处理手机验证码》手机验证码是一种常见的身份验证手段,广泛应用于用户注册、登录、交易确认等场景,下面我们来看看如何使用Python自动化处理手机验证码吧... 目录一、获取手机验证码1.1 通过短信接收验证码1.2 使用第三方短信接收服务1.3 使用ADB读取手机短信1.4 通过API获取

python安装whl包并解决依赖关系的实现

《python安装whl包并解决依赖关系的实现》本文主要介绍了python安装whl包并解决依赖关系的实现,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录一、什么是whl文件?二、我们为什么需要使用whl文件来安装python库?三、我们应该去哪儿下

MySQL安装时initializing database失败的问题解决

《MySQL安装时initializingdatabase失败的问题解决》本文主要介绍了MySQL安装时initializingdatabase失败的问题解决,文中通过图文介绍的非常详细,对大家的学... 目录问题页面:解决方法:问题页面:解决方法:1.勾选红框中的选项:2.将下图红框中全部改为英

Python脚本实现图片文件批量命名

《Python脚本实现图片文件批量命名》这篇文章主要为大家详细介绍了一个用python第三方库pillow写的批量处理图片命名的脚本,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录前言源码批量处理图片尺寸脚本源码GUI界面源码打包成.exe可执行文件前言本文介绍一个用python第三方库pi