首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:包'stomp.py‘需要不同的Python: 2.7.12而不是在'>=3.6,<4.0’中?

错误:包'stomp.py‘需要不同的Python: 2.7.12而不是在'>=3.6,<4.0’中?
EN

Ask Ubuntu用户
提问于 2020-08-17 13:23:24
回答 2查看 6.2K关注 0票数 2

我试图在我的ubuntu16.04上安装ElastAlert,每当我运行pip install elastalert时,我总是会遇到一个错误。我目前正在运行python 2.7.12。任何帮助都将不胜感激。我是新来的,所以不知道我做错了什么。错误信息如下:

代码语言:javascript
复制
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. 
Please upgrade your Python as Python 2.7 is no longer maintained. 
pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Defaulting to user installation because normal site-packages is not writeable
    Collecting elastalert
      Using cached elastalert-0.2.4.tar.gz (128 kB)
    Requirement already satisfied: apscheduler>=3.3.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (3.6.3)
    Requirement already satisfied: aws-requests-auth>=0.3.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.4.2)
    Requirement already satisfied: blist>=1.3.6 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (1.3.6)
    Requirement already satisfied: boto3>=1.4.4 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (1.12.28)
    Requirement already satisfied: configparser>=3.5.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (4.0.2)
    Requirement already satisfied: croniter>=0.3.16 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.3.31)
    Collecting elasticsearch==7.0.0
      Using cached elasticsearch-7.0.0-py2.py3-none-any.whl (80 kB)
    Requirement already satisfied: envparse>=0.2.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.2.0)
    Requirement already satisfied: exotel>=0.1.3 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.1.5)
    Collecting jira>=2.0.0
      Using cached jira-2.0.0-py2.py3-none-any.whl (57 kB)
    Collecting jsonschema>=3.0.2
      Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
    Collecting mock>=2.0.0
      Using cached mock-3.0.5-py2.py3-none-any.whl (25 kB)
    Collecting prison>=0.1.2
      Using cached prison-0.1.3-py2.py3-none-any.whl (5.8 kB)
    Requirement already satisfied: PyStaticConfiguration>=0.10.3 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.10.4)
    Collecting python-dateutil<2.7.0,>=2.6.0
      Using cached python_dateutil-2.6.1-py2.py3-none-any.whl (194 kB)
    Requirement already satisfied: PyYAML>=3.12 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (5.3.1)
    Requirement already satisfied: requests>=2.10.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (2.23.0)
    Requirement already satisfied: stomp.py>=4.1.17 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (6.0.0)
    ERROR: Package 'stomp.py' requires a different Python: 2.7.12 not in '>=3.6,<4.0'
EN

回答 2

Ask Ubuntu用户

发布于 2020-08-17 13:36:50

错误是相当明显的。您要安装的包只支持Python 3.6+。

您可以选择安装更新的python (其中有许多在线指南),或者升级到更新的Ubuntu发行版(16.04即将结束)。

票数 5
EN

Ask Ubuntu用户

发布于 2020-08-17 13:50:39

看起来您设法安装了一个新版本的stomp.py (6.0.0),它与Python2不兼容,后者只支持4.x.x版

我建议您卸载stomp.py,并让它再次安装正确的版本作为依赖项。我在一个新鲜的Ubuntu16.04容器中测试了它,它对我来说很好,不过请记住,您还需要最新版本的pipsetuptools来正确构建和安装所有东西,就像我尝试的那样:

代码语言:javascript
复制
pip install --upgrade pip
pip install --upgrade setuptools
pip uninstall stomp.py
pip install elastalert

这就是说,虽然可以在Python2.7上安装elastalert,但它也兼容Python3(经过测试的Ubuntu16.04‘S默认3.5),这应该是可行的方法,除非您有某种特定的阻碍,因为Python2已经过时,不再支持更新。

代码语言:javascript
复制
apt install python3-pip
pip3 install elastalert
票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1267917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档