win10系统 anaconda3 虚拟环境运行python3.8 的程序时出现这种错误。需要安装对应的包。
先安装cython
pip install Cython
如果安装速度慢,选择清华源安装
然后安装pycocotools
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI
如果一切顺利,下面的内容不用看。
第二个命令的安装,可能因为网络慢 中断安装失败
如下图失败代码:
Collecting pycocotools
Cloning https://github.com/philferriere/cocoapi.git to c:\users\yang\appdata\local\temp\pip-install-x412aedn\pycocotools_b0fe926af74b45e0b5e19b1c2c98136e
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\YANG\AppData\Local\Temp\pip-install-x412aedn\pycocotools_b0fe926af74b45e0b5e19b1c2c98136e'
fatal: unable to access 'https://github.com/philferriere/cocoapi.git/': OpenSSL SSL_read: Connection was reset, errno 10054
WARNING: Discarding git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI. Command errored out with exit status 128: git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\YANG\AppData\Local\Temp\pip-install-x412aedn\pycocotools_b0fe926af74b45e0b5e19b1c2c98136e' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pycocotools (unavailable) (from versions: 2.0.0, 2.0.1, 2.0.2a1, 2.0.2, 2.0.3, 2.0.4)
ERROR: No matching distribution found for pycocotools (unavailable)
解决方法:重新运行一下 上面的命令即可。耐心等待,速度比较慢。这个没有国内的源可以选择。
最后安装成功
安装成功的信息如下:
Collecting pycocotools
Cloning https://github.com/philferriere/cocoapi.git to c:\users\yang\appdata\local\temp\pip-install-njt3jl5w\pycocotools_82f7cd57cf2b4aa2a4b072bb27f175f4
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\YANG\AppData\Local\Temp\pip-install-njt3jl5w\pycocotools_82f7cd57cf2b4aa2a4b072bb27f175f4'
Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... done
Created wheel for pycocotools: filename=pycocotools-2.0-cp38-cp38-win_amd64.whl size=78919 sha256=afd58812ead690ff95575de39883dd61a3d5927da5df27a2b60ff1817229ffea
Stored in directory: C:\Users\YANG\AppData\Local\Temp\pip-ephem-wheel-cache-7thtvdkx\wheels\bd\1c\0d\8c82e1b9bc855b82e1eb53eadea4459efe171d2daf5a222701
Successfully built pycocotools
Installing collected packages: pycocotools
Successfully installed pycocotools-2.0