无法使用Python3.6运行mypy:“未安装typed_ast软件包”但已安装

时间:2019-04-01 19:07:14

标签: python python-3.x mypy

当我像这样运行mypy时:

mypy file.py

它给我抛出一个错误Variable annotation syntax is only supported in Python 3.6 and greater。好的,我试图这样运行它:

python3.6 -m mypy file.py

但是它给出了The typed_ast package is not installed。好的,我用sudo pip3 install typed_ast --target=/usr/lib/python3.6 --upgrade安装了它。之后,我检查了要安装的软件包:

sanyash@sanyash-ub16:~/myrepos/trash$ python3.6
Python 3.6.6 (default, Jun 28 2018, 04:42:43) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typed_ast
>>> Ok, no import error

但是命令python3.6 -m mypy file.py仍然失败,并显示The typed_ast package is not installed。为什么?我该如何解决?通常,我可以使用python3.6运行mypy吗?

0 个答案:

没有答案
相关问题