使用基本类型hin时mypy中的分析错误

2024-05-19 13:59:59 发布

您现在位置:Python中文网/ 问答频道 /正文

今晚我第一次安装了Mypy(在Linux下运行,在Chromebook上)。你知道吗

当我运行mypy --python-version 3.7 -c "i:int=1"时,Mypy给了我错误:

test.py:1: error: Parse error before :

我怎么知道是什么原因造成的?你知道吗

EDIT:似乎--python-version 3.7选项不起作用(或者没有像我认为的那样起作用);我在--python-version 3.9中遇到了同样的错误。我安装的python版本是:

ricky@penguin:~$ python -V
Python 2.7.13
ricky@penguin:~$ python3 -V
Python 3.7.3

即使在虚拟环境中运行Mypy,错误仍然存在(也是版本3.7.3)。你知道吗


Tags: pytest版本parseversionlinux错误error