【发布时间】:2018-07-06 08:59:43
【问题描述】:
我正在学习mypy,我得到的第一个错误是cannot find module。
我的文件是:
from tzwhere import tzwhere
tzw = tzwhere.tzwhere()
print(tzw)
它可以被python运行,因为安装了tzwhere包。但是当我通过 mypy 运行它时,我得到了这个:
mypy mp.py
mp.py:1: error: Cannot find module named 'tzwhere'
mp.py:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
如何让它说出No library stub file for module 'tzwhere' 并处理存根文件而不是Cannot find module?
【问题讨论】:
-
你在使用
virtualenv吗? -
@AzatIbrakov 我正在使用
pipenv。 -
问题可能是你已经全局安装了
mypy(并从那里调用它)并且tzwhere安装在你的本地环境中