带pyuno的python2.7

带pyuno的python2.7,python,python-2.7,python-2.x,pyuno,Python,Python 2.7,Python 2.x,Pyuno,我正在Windows7上安装python 2.7。我已经安装了python 2.6附带的Libre Office 3.4。因此,即使设置了所有环境变量,我也无法导入uno和unohelper 我需要Python2.7,因此无法恢复到Python2.6,就像我之前在OpenOffice3中使用Python2.6一样。我最近改为libreoffice3.4和python2.7(activepython2.7) 有没有办法让python 2.7导入LibreOffice 3.4的uno和unohelo

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

我需要Python2.7,因此无法恢复到Python2.6,就像我之前在OpenOffice3中使用Python2.6一样。我最近改为libreoffice3.4和python2.7(activepython2.7)

有没有办法让python 2.7导入LibreOffice 3.4的uno和unoheloper


提前感谢。

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

从问题答案中提供的链接:

术语:我们将随OpenOffice安装的Python版本称为 “面向对象Python”。让我们调用单独安装的Python版本(以 c:\Python26,例如)系统Python

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


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

  • 卸载libreoffice和openoffice

    sudo apt-get remove libreoffice* openoffice*
    sudo apt-get autoremove
    
  • 在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
    
    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
    
  • 在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-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
    
    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
    
  • 触摸uno.pth以查看Python 2.7

    echo /opt/openoffice4/program |sudo tee /usr/lib/python2.7/dist-packages/uno.pth
    

  • 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
    

    我的系统上没有安装Python2.6,因此我尝试将LibreOffice 3.4中的python.exe路径设置为“C:\Program Files(x86)\LibreOffice 3.4\Program\python.exe”。我不知道我所尝试的是否正确,也不知道这种提供脚本所需的python可执行版本的方式是否正确。@PyBegginer:如果System和LibreOffice python的版本不同,那么您就无法运行使用随系统python一起随LibreOffice安装的
    pyuno
    的代码。它不会阻止您从发布的路径使用python运行它
    pylauncher
    允许您运行脚本,而无需每次指定python版本(您在脚本的
    “#!”
    -行中执行一次)。看法