gpt4 book ai didi

python - 导入 openpyxl 时语法无效

转载 作者:行者123 更新时间:2023-12-04 19:55:36 25 4
gpt4 key购买 nike

Python 2.7.5 (default, Sep 26 2019, 13:23:47)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<user>/.local/lib/python2.7/site-packages/openpyxl/__init__.py", line 6, in <module>
from openpyxl.workbook import Workbook
File "<user>/.local/lib/python2.7/site-packages/openpyxl/workbook/__init__.py", line 4, in <module>
from .workbook import Workbook
File "<user>/.local/lib/python2.7/site-packages/openpyxl/workbook/workbook.py", line 7, in <module>
from openpyxl.worksheet.worksheet import Worksheet
File "<user>/.local/lib/python2.7/site-packages/openpyxl/worksheet/worksheet.py", line 396
return f"{get_column_letter(min_col)}{min_row}:{get_column_letter(max_col)}{max_row}"

是否需要安装任何额外的软件包?

谁能让我知道这种行为背后的原因,因为它在 Windows 和 Macos 上运行良好。

最佳答案

您安装的 openpyxl 软件包使用 f-strings 。它们出现在 Python 3.6 中。您应该从 Python 2.7.5 切换到 Python 3.6 或更高版本。或者找到与 Python 2.x 兼容的 openpyxl 软件包版本。

关于python - 导入 openpyxl 时语法无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com