Python-pptx Python 3.5.1

Python-pptx for Python 3.5.1

Python3.5.1 可以使用 pptx (Python-pptx) 模块吗?例如:

from pptx import Presentation
from pptx.util import Pt

如果不能,那么更换此模块最简单的方法是什么?我认为结果应该无关紧要,但我将 PyCharm 用作 IDE.

我尝试用 pip install python-pptx 安装它。当我安装 Pandas 和 matplotlib 和其他模块时,使用 pip 安装工作得很好。但是当我尝试安装 Python-pptx 时,我得到:ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"。然后我在 google 上搜索,但只发现这是不可能的,因为 Python-pptx 只支持 python 3.4 或更低版本,现在 python 3.5(我看到的)

这就是为什么我开始怀疑是否有可能仍然让它工作的变通方法。如果没有,如果还有其他模块像 Python-pptx 这样工作,那么我就不必过多地更改我的整个代码。

3.4 和 3.5 之间的差异不太可能破坏已经能够处理 2.7 及更低版本的软件包,差异并不大。

这听起来更像是您没有为 python-pptx 所依赖的 lxml 安装正确的二进制文件。由于 lxml 仅可用作 python 3.2 的轮子,您的 pip 安装会尝试从源代码编译 lxml

根据包含 \r\n 的消息,我假设您正在使用 Windows,对于 Python 3.5,PyPI, so what you should try is install lxml from the unofficial builds from Christoph Gohlke in particular one of the last two, that have cp35 in the name, from the lxml section here 上的 lxml 没有轮子(这一个取决于您的计算机 运行 32 位或 64 位)。

之后尝试重新安装python-pptx

我不知道为什么我现在看到这个,但我可以说一件事:

我的包 (md2pptx) 使用 Python-pptx,它需要 3.8 或更高版本(对于“海象运算符”)。

所以,5 年零 3 个月:-),Python-pptx 与非常现代的 Python.

一起工作