首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ModuleNotFoundError:在安装cython后安装pycocotools时没有名为“cython”的模块

ModuleNotFoundError:在安装cython后安装pycocotools时没有名为“cython”的模块
EN

Stack Overflow用户
提问于 2020-02-03 16:26:22
回答 1查看 6.6K关注 0票数 4

在用python 3.6.9在环境中安装pycocotools时,我遇到了问题。

我正在windows 10上运行ubuntu18.04,我创建了一个环境并激活了它。我想安装软件包,我使用:

代码语言:javascript
复制
pip install <package> --user

当我安装cython时,它工作得很好,但是,当我安装pycocotools时:

代码语言:javascript
复制
pip install pycocotools --user

我的错误如下:

代码语言:javascript
复制
Downloading https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz (1.5MB)
100% |████████████████████████████████| 1.5MB 1.9MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-mut7_bkf/pycocotools/setup.py", line 2, in <module>
    from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mut7_bkf/pycocotools/

我不理解这个错误,因为cython是在安装之前安装的,并且在安装过程中没有错误消息。

更新1

问题仍然存在,当我使用

代码语言:javascript
复制
python3 -m pip install 

但是我有件有趣的事。在活跃的环境中:

代码语言:javascript
复制
@ : python3 -m pip --version
@ : pip 9.0.1 from /env/lib/python3.6/site-packages (python 3.6)

@ : python3 -m pip install --upgrade pip --user
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Collecting pip
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.6MB/s
Installing collected packages: pip
Successfully installed pip-20.0.2

@ : python3 -m pip --version
@ : pip 9.0.1 from /env/lib/python3.6/site-packages (python 3.6)

所以,这个包是正确下载和安装的,但是当我调用它时没有什么变化。我怀疑一个路径差异,但不知道如何解决它。

有人能帮我吗?

最好的

克里斯

EN

回答 1

Stack Overflow用户

发布于 2020-02-04 04:34:41

正确的安装应该是这样的。

代码语言:javascript
复制
pip3 install Cython

pip3 install pycocotools

如果您使用conda环境

代码语言:javascript
复制
conda install -c anaconda cython

conda install -c conda-forge pycocotools
conda install -c conda-forge/label/gcc7 pycocotools     #choose one of these three
conda install -c conda-forge/label/cf201901 pycocotools

更新

如果上面的语句不起作用,这意味着您正在使用多个python版本。在安装这样的包时,可以指定您的python版本。

代码语言:javascript
复制
python3.6 -m pip install cython

如果您在执行这些步骤后发现任何错误,请将错误日志添加到您的问题中。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60043297

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档