简体   繁体   English

如何在 LibreOffice 中安装或激活 PyUno?

[英]How do you install or activate PyUno in LibreOffice?

How do you make Python (any Python) know about PyUno in LibreOffice?您如何让 Python(任何 Python)了解 LibreOffice 中的 PyUno?

When I do:当我做:

import uno

python says that it knows no module "uno". python 说它不知道模块“uno”。 (This question came up re. this question .) (这个问题是关于这个问题的。)

I am having the same issue with ubuntu 14.04 and python 2.7.6. 我对ubuntu 14.04和python 2.7.6也有同样的问题。

But if you are using ubuntu 12.04, try using sudo apt-get install python-uno. 但是如果您使用的是ubuntu 12.04,请尝试使用sudo apt-get install python-uno。

(UPDATING for 2014's) (更新2014年)

Perhaps the most used UNO application is document convertion ... For this task, in nowadays, you not need UNO, you can use directly 也许最常用的UNO应用程序是文档转换 ...对于这个任务,在现今,你不需要UNO,你可以直接使用

libreoffice --convert-to

About UNO itself, see the new home page, http://api.libreoffice.org/ 关于UNO本身,请参阅新主页, http://api.libreoffice.org/

A good example of using python3-uno (or python-uno ) is the Docvert conversor ( Docvert for py2 ). 使用python3-uno (或python-uno )的一个很好的例子是Docvert转换器Docvert for py2 )。

As said in the response to your comment there: it's an optional installable component for OpenOffice. 正如您在评论中所说:它是OpenOffice的可选可安装组件。 See the Introduction to Python on OOo page in OpenOffice's Wiki for installation details 有关安装的详细信息,请参阅OpenOffice Wiki中的OOo上的Python简介页面

对于 Debian、Ubuntu 和衍生产品:

sudo apt install libreoffice-script-provider-python

Here's what I did: 这是我做的:

inside the LibreOffice directory, there is a "program" directory with a python.exe, if I use that python (which is at version 2.6.1), I can import uno. 在LibreOffice目录中,有一个带有python.exe的“程序”目录,如果我使用那个python(版本为2.6.1),我可以导入uno。

Try importing the libre office python extension. 尝试导入libre office python扩展。

yum install libreoffice-pyuno yum install libreoffice-pyuno

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM