由于某些依赖性,我使用 Python 3.10 作为我的日常驱动程序。现在,我只需下载Python 3.11,安装它,并成功使用环境。
(env311) PS D:\user\package> py
Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
我安装它是因为我想利用新的错误消息指针。但是,为什么我会得到这个?
>>> import itertools
>>>
>>> c = itertools.counter()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'itertools' has no attribute 'counter'. Did you mean: 'count'?
它没有产生在 this 和 this 声称的更好的错误消息,如下所示:
Traceback (most recent call last):
File "util.py", line 3, in <module>
c = itertools.counter()
^^^^^^^^^^^^^^^^^
AttributeError: module 'itertools' has no attribute 'counter'. Did you mean: 'count'?
您处于交互模式。您正在寻找的功能仅在源文件可用时才有效。它不适用于交互式输入的语句。