带有 pyuno 的 Python 2.7

标签 python python-2.7 python-2.x pyuno

我在 Windows 7 上安装了 python 2.7。我已经安装了 python 2.6 附带的 Libre Office 3.4。因此,即使设置了所有环境变量,我也无法导入 uno 和 unohelper。

我需要 python 2.7,因此无法恢复到 python 2.6,因为我之前使用 python 2.6 与 open office 3 一起工作。我最近更改为 LibreOffice 3.4 和 Python 2.7(ActivePython 2.7)。

有什么方法可以让 python 2.7 导入 LibreOffice 3.4 的 uno 和 unohelper

提前致谢。

最佳答案

.pyc 文件和 C 扩展在 2.6 和 2.7 Python 版本之间不兼容。安装pylauncher并在与 Libre Office 配合使用的脚本中使用 python2.6 shebang。

来自 OpenOffice.org development with pyUno for Windows—which Python? 的答案中提供的链接问题:

Terms: Let's call the version of Python installed with OpenOffice the 'OO-Python'. Let's call the version of Python installed separately (to c:\Python26, for example) the 'System-Python'.

You need to know SIX things to sucessfully import the uno module into your System-Python interpreter. 1) The OO-Python version number. Your System-Python version number must be the same as your OO-Python version number. [emphasis mine] ...

关于带有 pyuno 的 Python 2.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7763972/

相关文章:

php - Python 中的安全 MySQL 连接

python - 确定类是否具有用户定义的 __init__

PYTHON-2.x 第 1 行出现语法错误,但我没有看到任何错误?

python - 当被告知插入 '\r\n' 时,用于 Windows 的 Python 会插入 '\n' 吗?

python - 如何在python中对日期进行排序?

python - 将 django sqlite 数据库迁移到 postgresql

python - 最无缝的 TDD/测试技术

python - Sympify() 和 Eval() 方程不在函数内执行

Python Ctypes 将 void 指针转换为 nonetype 和 long。有什么影响?这是什么意思?

python - python 2.7 中的等效 urllib.parse.unquote()