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

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

深入探索协同过滤:从原理到推荐模块案例

文章目录 前言一、协同过滤1. 基于用户的协同过滤(UserCF)2. 基于物品的协同过滤(ItemCF)3. 相似度计算方法 二、相似度计算方法1. 欧氏距离2. 皮尔逊相关系数3. 杰卡德相似系数4. 余弦相似度 三、推荐模块案例1.基于文章的协同过滤推荐功能2.基于用户的协同过滤推荐功能 前言     在信息过载的时代,推荐系统成为连接用户与内容的桥梁。本文聚焦于

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

如何解决线上平台抽佣高 线下门店客流少的痛点!

目前,许多传统零售店铺正遭遇客源下降的难题。尽管广告推广能带来一定的客流,但其费用昂贵。鉴于此,众多零售商纷纷选择加入像美团、饿了么和抖音这样的大型在线平台,但这些平台的高佣金率导致了利润的大幅缩水。在这样的市场环境下,商家之间的合作网络逐渐成为一种有效的解决方案,通过资源和客户基础的共享,实现共同的利益增长。 以最近在上海兴起的一个跨行业合作平台为例,该平台融合了环保消费积分系统,在短

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss