(个人记录)安装pycocotools库出现Could not build wheels for pycocotools which use PEP 517 and cannot be install

事先声明,问题已经解决,本文章为记录尝试过程以及最终解决方案。

本人使用的pycharm

第一次在pycharm中的Settings里尝试安装pycocotools时pycharm报错:

Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed foryour Python interpreter located at 'D:\Anaconda\envs\pytorch\python.exe'.

之后在anaconda软件中使用conda search进行搜索发现没有这个包,第二次上网搜索解决方法,尝试在'D:\Anaconda\envs\pytorch\'路径下打开命令窗口,输入python.exe -m pip install pycocotools -i http://pypi.douban.com/simple --trusted-host pypi.douban.com。(豆瓣国内源),于是出现了新的错误:

Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly

并建议我安装Microsoft Visual C++,由于太大,本人不想安装,于是寻找其他方法。

第三次尝试在anaconda的命令行中输入pip install pycocotools(摆烂试一下)发现与第二次尝试结果相同。

第四次上网搜索发现有人使用conda install pycocotools命令可以下载,试了下发现仍然不行,但anaconda中给出建议可以上网站https://anaconda.org中进行搜索查看,进入网站搜索pycocotools后发现应该是有人上传过这个包

选择第一个搜索结果后,发现下面有可以直接运行的命令

选择了第一个命令进行安装,最终成功。 

  • 8
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
引用\[1\]和\[2\]提供了关于安装cryptography的指南。根据这些指南,您需要执行以下步骤来安装cryptography: 1. 安装必要的依赖项:在Linux系统上,您可以使用以下命令安装依赖项: ``` $ apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo ``` 在Windows系统上,您可以按照\[3\]中提供的链接下载并安装Microsoft Visual C++ Build Tools。 2. 更新pip:使用以下命令更新pip: ``` $ pip install --upgrade pip ``` 3. 安装cryptography:使用以下命令安装cryptography: ``` $ pip install cryptography ``` 如果您在安装过程中遇到问题,请确保按照指南中的步骤进行操作,并检查您的系统是否满足所有要求。 关于您提到的错误信息"Failed to build pycocotools ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed direct",这是由于pycocotools使用了PEP 517来构建wheels,而无法直接安装。解决此问题的一种方法是手动构建和安装pycocotools。您可以按照以下步骤尝试解决此问题: 1. 克隆pycocotools的GitHub存储:使用以下命令克隆存储: ``` $ git clone https://github.com/cocodataset/cocoapi.git ``` 2. 进入cocoapi/PythonAPI目录:使用以下命令进入目录: ``` $ cd cocoapi/PythonAPI ``` 3. 执行以下命令来构建和安装pycocotools: ``` $ python setup.py build_ext --inplace $ python setup.py install ``` 这将手动构建并安装pycocotools。 请注意,这些解决方法是基于提供的引用内容,并可能因操作系统和环境的不同而有所变化。如果您遇到任何问题,请参考引用\[1\]和\[2\]中提供的官方文档或寻求相关支持。 #### 引用[.reference_title] - *1* *2* [ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly](https://blog.csdn.net/yunweigo/article/details/118416806)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directl](https://blog.csdn.net/weixin_44512987/article/details/128090249)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值