Installation
安装
Aspose.PSD FOSS for Python 是一个纯粹的 Python 包,没有其他第三方依赖。没有需要编译的本机扩展,因此在任何 Python 解释器支持的平台上,安装都会立即完成。
先决条件
| 要求 | 细节 |
|---|---|
| Python | 支持的 CPython 解释器 |
| 操作系统 | 任何受您的 Python 解释器支持的操作系统 |
| Dependencies | 无 — 纯 Python,不含第三方包 |
- 安装软件包。
git clone https://github.com/aspose-psd-foss/Aspose.PSD-FOSS-for-Python.git
cd Aspose.PSD-FOSS-for-Python
# No packaging manifest is published yet -- run from this folder,
# or add it to PYTHONPATH:
export PYTHONPATH=$PWD:$PYTHONPATH- 通过加载一个 PSD/PSB 文件来验证安装。
from aspose_psd_foss.psdimage import PsdImage
with PsdImage.load("input.psd") as image:
print(f"Width: {image.width}, Height: {image.height}")如果软件包正确安装,此操作将无错误地打印文档的尺寸。成功运行既证明解释器能够导入该软件包,又证明文件加载路径能够端到端工作,而不仅仅是安装步骤报告成功。