首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装autopy时出现“SyntaxError: invalid SyntaxError”

安装autopy时出现“SyntaxError: invalid SyntaxError”
EN

Stack Overflow用户
提问于 2021-06-29 08:18:13
回答 1查看 233关注 0票数 0

我需要运行需要autopy的代码(对于python2.7)

Python 2.7

setuptools-rust 0.11.4

autopy 4.0.0

代码语言:javascript
复制
C:\pip install autopy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. 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 autopy
  Using cached https://files.pythonhosted.org/packages/3d/3e/e589bfe03c7ee1c3d832dda10b908557f25a09d66acfc8fc7d982ee23d1a/autopy-4.0.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\unitedsalvatore\appdata\local\python\python27\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\united~1\\appdata\\local\\temp\\pip-install-j55cvn\\autopy\\setup.py'"'"'; __file__='"'"'c:\\users\\united~1\\appdata\\local\\temp\\pip-install-j55cvn\\autopy\\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 pip-egg-info
         cwd: c:\users\united~1\appdata\local\temp\pip-install-j55cvn\autopy\
    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\united~1\appdata\local\temp\pip-install-j55cvn\autopy\setup.py", line 8, in <module>
        from setuptools_rust import Binding, RustExtension
      File "c:\users\unitedsalvatore\appdata\local\python\python27\lib\site-packages\setuptools_rust\__init__.py", line 8, in <module>
        from .tomlgen import tomlgen_rust, find_rust_extensions
      File "c:\users\unitedsalvatore\appdata\local\python\python27\lib\site-packages\setuptools_rust\tomlgen.py", line 191
        yield dep, toml.loads(f"{dep} = {options}")[dep]
                                                 ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.3.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

为什么我看到这个错误?我是python的新手

EN

回答 1

Stack Overflow用户

发布于 2021-06-29 08:21:00

安装代码使用的是格式字符串(f字符串),只有Python 3.6+支持。由于您使用的是Python2.7,因此它无法识别这一点并引发语法错误。要解决此问题,您需要至少升级到Python 3.6或更高版本。

有关更多信息,Real Python有一篇很好的文章here

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68171224

复制
相关文章

相似问题

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