Python 版本错误,但 Python 版本有效?

0 python installation pip rasa

我通过 pip 安装 rasa 时遇到错误。错误信息如下所示,似乎提示我的Python版本不适用,但我的Python版本是3.11.3,肯定是在3.4以上。有人对这可能是什么有什么建议吗?

\n
Collecting rasa\n  Using cached rasa-1.10.2-py3-none-any.whl (510 kB)\nCollecting PyJWT<1.8,>=1.7 (from rasa)\n  Using cached PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)\nRequirement already satisfied: SQLAlchemy<1.4.0,>=1.3.3 in c:\\users\\ayu\\appdata\\roaming\\python\\python311\\site-packages (from rasa) (1.3.24)\nCollecting absl-py<0.10,>=0.9 (from rasa)\n  Using cached absl-py-0.9.0.tar.gz (104 kB)\n  Preparing metadata (setup.py) ... error\n  error: subprocess-exited-with-error\n\n  \xc3\x97 python setup.py egg_info did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [6 lines of output]\n      Traceback (most recent call last):\n        File "<string>", line 2, in <module>\n        File "<pip-setuptools-caller>", line 34, in <module>\n        File "C:\\Users\\albertgranz\\App\\Local\\Temp\\pip-install-ctiigi8b\\absl-py_f74b78151a764aaaabe5f2a103d08a3d\\setup.py", line 34, in <module>\n          raise RuntimeError('Python version 2.7 or 3.4+ is required.')\n      RuntimeError: Python version 2.7 or 3.4+ is required.\n      [end of output]\n\n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\n
Run Code Online (Sandbox Code Playgroud)\n

Fly*_*ler 5

setup.py这是由于其中absl-py-0.9.0.tar.gz包含行的版本比较不正确造成的

py_version = platform.python_version_tuple()
if py_version < ('2', '7') or py_version[0] == '3' and py_version < ('3', '4'):
  raise RuntimeError('Python version 2.7 or 3.4+ is required.')
Run Code Online (Sandbox Code Playgroud)

platform.python_version_tuple()是一个元组,即('3', '11', '4'). 由于 python 中元组比较的工作方式,('3', '11', '4') < ('3', '4')计算结果为True. 我会推荐:

  1. 从pypi下载absl-py-0.9.0.tar.gz
  2. 提取内容,打开setup.py并注释上述行
  3. python setup.py install在解压出来的目录下运行

这可以手动禁用此错误。

注意 rasa- 您最初尝试安装的似乎没有经过测试或不支持 python 3.11,因为它的依赖项无法在没有手动操作的情况下安装。它可能仍然有效,但更有可能的是,你将不得不降级你的 python 版本