python 库 pyparsing 中的未知版本

unknown version in python library pyparsing

我正在尝试在我的机器上安装 airnotifier,但出现此错误

我的python版本是3.6

PS C:\airnotifier> python app.py
Traceback (most recent call last):
  File "app.py", line 32, in <module>
    from pushservices.bootstrap import init_messaging_agents
  File "C:\airnotifier\pushservices\bootstrap.py", line 4, in <module>
    from .fcm import FCMClient
  File "C:\airnotifier\pushservices\fcm.py", line 5, in <module>
    from oauth2client.service_account import ServiceAccountCredentials
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\service_account.py", line 25, in <module>
    from oauth2client import client
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\client.py", line 39, in <module>
    from oauth2client import transport
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\transport.py", line 17, in <module>
    import httplib2
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 52, in <module>
    from . import auth
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\auth.py", line 4, in <module>
    import pyparsing as pp
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyparsing\__init__.py", line 130, in <module>
    __version__ = __version_info__.__version__
AttributeError: 'version_info' object has no attribute '__version__'

我收到了同样的错误,我也在 Python 3.6.0 ...

AttributeError: 'version_info' object has no attribute '__version__'

如果您想深入了解,可以在您的控制台中键入此内容并检测哪个包正在使用此依赖项。

> pip show pyparsing

在我的例子中,输出是这样的,表明 packaging:

  • Name: pyparsing
  • Version: 2.4.7
  • Summary: Python parsing module
  • License: MIT License
  • Location:
  • Requires:
  • Required-by: packaging

要修复它,您可以参考 PaulMcG

的建议
pip install pyparsing==2.4.7

2022 年 6 月 3 日更新:

参考问题

https://github.com/pyparsing/pyparsing/releases/tag/pyparsing_3.0.8

注释说:

API CHANGE: modified pyproject.toml to require Python version 3.6.8 or later for pyparsing 3.x. Earlier minor versions of 3.6 fail in evaluating the version_info class (implemented using typing.NamedTuple). If you are using an earlier version of Python 3.6, you will need to use pyparsing 2.4.7.