Skip to main content

📦 Installation

This page is currently only available in Chinese. Please switch to 简体中文 for the full content.

📦 Install python-office

System Requirements

  • Python version: 3.7+ (3.8+ recommended)
  • Operating system: Windows / macOS / Linux
  • Disk space: about 200 MB (including all optional dependencies)

Basic Installation

Get it done with a single command:

pip install python-office

💡 Tip: If you want to use all features (such as Word to PDF, PDF to image, etc.), installing the full dependencies is recommended.

Full Installation

pip install python-office[all]

Or install individual sub-libraries:

pip install poexcel # Excel
pip install poword # Word
pip install popdf # PDF
pip install poimage # Image
pip install pofile # File
pip install poemail # Email
pip install poocr # OCR
pip install povideo # Video
pip install pomarkdown # Markdown
pip install poppt # PPT
pip install PyOfficeRobot # WeChat

Mirror Acceleration (China)

pip install python-office -i https://pypi.tuna.tsinghua.edu.cn/simple

Other mirrors:

  • Alibaba Cloud: https://mirrors.aliyun.com/pypi/simple/
  • USTC: https://pypi.mirrors.ustc.edu.cn/simple/

Verify Installation

import office
print(office.__version__) # prints the version number such as 1.0.6

Upgrade

pip install python-office --upgrade

FAQ

pip install timeout

pip install python-office --timeout 120 -i https://pypi.tuna.tsinghua.edu.cn/simple

Word to PDF fails

  • Windows: install Microsoft Office or WPS
  • macOS: brew install --cask libreoffice
  • Linux: sudo apt install libreoffice

Permission errors

pip install python-office --user

Or use a virtual environment:

python -m venv myenv
source myenv/bin/activate # macOS/Linux
pip install python-office

Next Steps

AI 办公效率课
35 讲 AI 自动化办公实战课用 Python + AI 处理 Excel、Word、PDF、邮件等办公场景。
去学习