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

相关文章

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

Python脚本实现自动删除C盘临时文件夹

《Python脚本实现自动删除C盘临时文件夹》在日常使用电脑的过程中,临时文件夹往往会积累大量的无用数据,占用宝贵的磁盘空间,下面我们就来看看Python如何通过脚本实现自动删除C盘临时文件夹吧... 目录一、准备工作二、python脚本编写三、脚本解析四、运行脚本五、案例演示六、注意事项七、总结在日常使用

Python将大量遥感数据的值缩放指定倍数的方法(推荐)

《Python将大量遥感数据的值缩放指定倍数的方法(推荐)》本文介绍基于Python中的gdal模块,批量读取大量多波段遥感影像文件,分别对各波段数据加以数值处理,并将所得处理后数据保存为新的遥感影像... 本文介绍基于python中的gdal模块,批量读取大量多波段遥感影像文件,分别对各波段数据加以数值处

python管理工具之conda安装部署及使用详解

《python管理工具之conda安装部署及使用详解》这篇文章详细介绍了如何安装和使用conda来管理Python环境,它涵盖了从安装部署、镜像源配置到具体的conda使用方法,包括创建、激活、安装包... 目录pytpshheraerUhon管理工具:conda部署+使用一、安装部署1、 下载2、 安装3

Python进阶之Excel基本操作介绍

《Python进阶之Excel基本操作介绍》在现实中,很多工作都需要与数据打交道,Excel作为常用的数据处理工具,一直备受人们的青睐,本文主要为大家介绍了一些Python中Excel的基本操作,希望... 目录概述写入使用 xlwt使用 XlsxWriter读取修改概述在现实中,很多工作都需要与数据打交

使用Python实现在Word中添加或删除超链接

《使用Python实现在Word中添加或删除超链接》在Word文档中,超链接是一种将文本或图像连接到其他文档、网页或同一文档中不同部分的功能,本文将为大家介绍一下Python如何实现在Word中添加或... 在Word文档中,超链接是一种将文本或图像连接到其他文档、网页或同一文档中不同部分的功能。通过添加超

C#使用HttpClient进行Post请求出现超时问题的解决及优化

《C#使用HttpClient进行Post请求出现超时问题的解决及优化》最近我的控制台程序发现有时候总是出现请求超时等问题,通常好几分钟最多只有3-4个请求,在使用apipost发现并发10个5分钟也... 目录优化结论单例HttpClient连接池耗尽和并发并发异步最终优化后优化结论我直接上优化结论吧,

Python MySQL如何通过Binlog获取变更记录恢复数据

《PythonMySQL如何通过Binlog获取变更记录恢复数据》本文介绍了如何使用Python和pymysqlreplication库通过MySQL的二进制日志(Binlog)获取数据库的变更记录... 目录python mysql通过Binlog获取变更记录恢复数据1.安装pymysqlreplicat

利用Python编写一个简单的聊天机器人

《利用Python编写一个简单的聊天机器人》这篇文章主要为大家详细介绍了如何利用Python编写一个简单的聊天机器人,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 使用 python 编写一个简单的聊天机器人可以从最基础的逻辑开始,然后逐步加入更复杂的功能。这里我们将先实现一个简单的

基于Python开发电脑定时关机工具

《基于Python开发电脑定时关机工具》这篇文章主要为大家详细介绍了如何基于Python开发一个电脑定时关机工具,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. 简介2. 运行效果3. 相关源码1. 简介这个程序就像一个“忠实的管家”,帮你按时关掉电脑,而且全程不需要你多做