5

我在 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

提前致谢。

4

3 回答 3

3

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

从答案中提供的链接使用 pyUno for Windows 进行 OpenOffice.org 开发 - 哪个 Python?问题:

术语:我们将随 OpenOffice 一起安装的 Python 版本称为“OO-Python”。让我们将单独安装的 Python 版本(例如,安装到 c:\Python26)称为“System-Python”。

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

于 2011-10-14T07:05:27.713 回答
3

ubuntu 13.10 及更高版本,您需要安装 openoffice 4.1.1。

  1. 卸载 libreoffice 和 openoffice

    sudo apt-get remove libreoffice* openoffice*
    sudo apt-get autoremove
    
  2. 在 64 位 Ubuntu 上安装 Apache OpenOffice 4.1.1

    wget sourceforge.net/projects/openofficeorg.mirror/files/4.1.1/binaries/en-GB/Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-GB.tar.gz
    tar -xzvf Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-GB.tar.gz
    cd en-GB/DEBS
    sudo dpkg -i *.deb
    cd desktop-integration
    sudo dpkg -i *.deb
    
  3. 在 32 位 Ubuntu 上安装 Apache OpenOffice 4.1.1

    wget sourceforge.net/projects/openofficeorg.mirror/files/4.1.1/binaries/en-GB/Apache_OpenOffice_4.1.1_Linux_x86_install-deb_en-GB.tar.gz
    tar -xzvf Apache_OpenOffice_4.1.1_Linux_x86_install-deb_en-GB.tar.gz
    cd en-GB/DEBS
    sudo dpkg -i *.deb
    cd desktop-integration
    sudo dpkg -i *.deb
    
  4. 为 python2.7 触摸 uno.pth

    echo /opt/openoffice4/program |sudo tee /usr/lib/python2.7/dist-packages/uno.pth
    
于 2015-01-16T08:56:55.097 回答
1

在 Ubuntu 14.04 中

打开终端并运行以下命令...

sudo apt-get install libreoffice python-genshi python-cairo python-lxml python-setuptools
sudo apt-get install libreoffice-script-provider-python
easy_install uno
于 2016-10-14T11:31:28.237 回答