安装robot frameworkappiumlibrary时出现以下错误

2024-05-16 21:38:50 发布

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

D:\Users\SBhagyad>pip install robotframework-appiumlibrary
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
Collecting robotframework-appiumlibrary
  Using cached robotframework_appiumlibrary-1.5.0.6-py2.py3-none-any.whl (33 kB)
Requirement already satisfied: robotframework>=2.6.0 in c:\python27\lib\site-packages (from robotframework-appiumlibrary) (3.1.2)
Requirement already satisfied: six>=1.10.0 in c:\python27\lib\site-packages (from robotframework-appiumlibrary) (1.14.0)
Collecting Appium-Python-Client>=0.28
  Using cached Appium-Python-Client-1.0.1.tar.gz (51 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python27\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'d:\\users\\sbhagyad\\appdata\\local\\temp\\1\\pip-install-qb7jnj\\Appium-Python-Client\\setup.py'"'"'; __file__='"'"'d:\\users\\sbhagyad\\appdata\\local\\temp\\1\\pip-install-qb7jnj\\Appium-Python-Client\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'd:\users\sbhagyad\appdata\local\temp\1\pip-pip-egg-info-dvpaun'
         cwd: d:\users\sbhagyad\appdata\local\temp\1\pip-install-qb7jnj\Appium-Python-Client\
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:\users\sbhagyad\appdata\local\temp\1\pip-install-qb7jnj\Appium-Python-Client\setup.py", line 19, in <module>
        from appium.common.helper import library_version
      File "appium\common\helper.py", line 20
        def extract_const_attributes(cls: type) -> Dict[str, Any]:
                                        ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

错误

尝试安装robot framework appiumlibrary CMD时出错 请帮助提供解决方案 我正在使用Python 2.7和Robot Framework 3.1.2(win32上的Python 2.7.16)


Tags: installpipinpyclientlocalsetupusers
3条回答

您尝试使用的库不支持Python2.7,因为Python2.7很旧,不安全,不受支持

升级到受支持的Python版本

从错误消息的外观来看,它使用类型暗示,因此您至少需要Python3.5。然而,3.5也将在September 2020中终结,因此值得更新到最新版本,目前为3.8

您还应该为每个项目使用虚拟环境。这将使您可以轻松地在系统上使用不同版本的Python和其他库

如果您像我一样被迫使用Python 2.7,那么解决方案是首先安装兼容版本的Appium Python客户端,然后安装AppiumLibrary。 为此,可以运行以下命令:

pip install Appium-Python-Client==0.52
pip install robotframework-appiumlibrary

我建议就AppiumLibrary github编写一份报告,因为Python 2.7仍然应该得到充分支持。这毕竟是一个很大的问题

更新:问题在于appium python客户端依赖关系,Python2不再支持该依赖关系。目前唯一可行的选择是更新到Python3并告诉开发人员这是一个问题。或者,如果可能的话,您可以考虑安装一个可用于Python2的旧版本

相关问题 更多 >