即使已安装模块,也会导入ImportError

时间:2017-04-17 20:36:06

标签: python-2.7

我在虚拟环境中安装软件包。

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

但如果我使用pip进行安装,则说:

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

1 个答案:

答案 0 :(得分:0)

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

(venv)$ pip install constants