当前位置:首页  电脑知识  其它

Windows系统下正确安装cython_bbox库的方法

Windows系统下正确安装cython_bbox库的方法

日期:2023-09-26 19:42:50来源:浏览:

前言

最近做的项目需要安装cython_bbox包,但是当我天真的输入pip install cython_bbox准备满心欢喜的等待安装成功却发现...,它报错了,这是一个从未见过的、非常长的报错,它长这个样子:

我震惊了!这是个啥子 ? 辗转反侧,不能眠的我,天真的又加上了中科大源加速,发现并不是速度问题,依旧不出意外的失败了,可是网上的教程就是这么装的呀?我一直不明所以,直到有一天在github上才寻找到了答案,所以这篇文章,正是为了分享这一次踩坑的经历,帮助大家跳过我悲惨的经历。 

正确安装步骤 

一、安装cython

cython非常容易安装:

pip install cython

 太慢了?加速安装!

pip install cython -i https://pypi.mirrors.ustc.edu.cn/simple

二、安装cython_bbox

这是一条非常珍贵的命令,找了好久才找到的:(有时候运行该命令一次便可以安装成功,有时候要运行好几次,这可能和网络有关。)

pip install -e git+https://github.com/samson-wang/cython_bbox.git#egg=cython-bbox

三、 安装pycocotools

安装pycocotools是因为这个包经常与cython_bbox合作使用,也就是讲:安装了cython_bbox,那么安装pycocotools已经是一种非常常见的配套安装。

pip install pycocotools

太慢了?加速安装

pip install pycocotools -i https://pypi.mirrors.ustc.edu.cn/simple

完毕!

附:安装cython_bbox报错解决办法:Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

报错内容如下图所示:

Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-a509pn1e/cython-bbox_4f8cde4aec364123b4ba34e507b2a155/setup.py", line 10, in <module>
          from Cython.Build import cythonize
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
 
&times; Encountered error while generating package metadata.
╰─> See above for output.

解决办法:

先安装Cpython然后再安装cython_bbox

pip install Cythonpip install cython_bbox

注意在ubuntu系统下去安装,在windows系统上我尝试了还是安装不成功,还没发现如何解决,如果有成功方法的可评论区留言。

相关推荐