我在虚拟环境中安装软件包。
(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
答案 0 :(得分:0)
我认为您应该在虚拟环境中尝试pip install constants
(venv)$ pip install constants