带有 pyuno 的 Python 2.7 [英] Python 2.7 with pyuno

查看:24
本文介绍了带有 pyuno 的 Python 2.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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 withpyUno for Windows——哪个 Python? 问题:

<块引用>

条款:让我们将随 OpenOffice 安装的 Python 版本称为'OO-Python'.让我们调用单独安装的 Python 版本(以c:\Python26,例如)'System-Python'.

你需要知道六件事才能成功地将 uno 模块导入到你的系统 Python 解释器.1) OO-Python 版本号.你的System-Python 版本号必须与您的 OO-Python 相同版本号. [强调我的]...

I am having python 2.7 installed on my windows 7. I have installed Libre Office 3.4 which comes with python 2.6. Hence i am not able to import uno and unohelper even after setting all environment variables.

I need python 2.7 thus cannot revert back to python 2.6, as i earlier had python 2.6 working with open office 3. I recently changed to LibreOffice 3.4 and Python 2.7(ActivePython 2.7).

Is there any way i can make python 2.7 to import uno and unohelper of LibreOffice 3.4

Thanks in advance.

解决方案

.pyc files and C extensions are not compatible between 2.6 and 2.7 Python versions. Install pylauncher and use python2.6 shebang in scripts that work with Libre Office.

From the link provided in the answer to OpenOffice.org development with pyUno for Windows—which Python? question:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆