简体   繁体   English

即使模块已安装,也会发生ImportError

[英]ImportError even though the module is already installed

I'm installing packages on virtual env. 我正在虚拟环境上安装软件包。

    (venv)pynanomsg]$ python
    >>> import constants 
    Traceback (most recent call last):  
       File "<stdin>", line 1, in <module> 
    ImportError: No module named constants

But if I install it using pip , it says: 但是,如果我使用pip安装它,它会说:

$ pip install constants
Requirement already satisfied: constants in      /usr/local/lib/python2.7/site-packages

我认为您应该在虚拟环境中尝试pip install constants

(venv)$ pip install constants

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ImportError:即使已安装模块,也没有名为请求的模块 - ImportError: No module named requests - even though it is installed 模块已安装,但出现“ ImportError” - Module already installed but “ImportError” ImportError:即使安装了适用于python的google-cloud,也没有名为Cloud的模块 - ImportError: No module named cloud even though google-cloud for python is installed 即使安装了名为 gevent 的模块 - no module named gevent even though it is installed 即使已安装,也没有名为 scipy 的模块 - No module named scipy even though it is installed 使用 tox 运行 python 单元测试时遇到问题 - 已安装模块的 ImportError - Trouble running python unit tests with tox - ImportError for module that is already installed 为什么即使安装了 FBX 模块也找不到? - Why does it say FBX module not found even though it is installed? PyCharm IDE:已经安装了boto,但是得到了一个“没有名为boto.cloudfront的模块” importError - PyCharm IDE: boto is already installed but got a “No module named boto.cloudfront” importError 由Miniconda安装的ImportError``No Module Named Pandas&#39;&#39; - ImportError ''No Module Named Pandas'', installed by Miniconda 需求已经满足但是ImportError:没有名为“pkg”的模块 - Requirement already satisfied but ImportError: No module named “pkg”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM