将 gspread 导入 LibreOffice

问题描述 投票:0回答:1

我的系统:

Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:    23.04
Codename:   lunar
LibreOffice 7.5.5.2 50(Build:2)

geany 1.38 (built on 2021-10-14 with GTK 3.24.30, GLib 2.68.4)
Python 3.11.4

我正在尝试导入 gspread 以与 LibreOffice 宏一起使用。

~$ pip install gspread --user --upgrade
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

我该去哪里?我可以将 tarball 加载到

/usr/lib/libreoffice/share/Scripts/Python
不破坏任何东西?

我原以为 gspread 已经安装在 LibreOffice 中...但是当我运行我的宏时,它显示一个错误,说找不到它。然后我尝试将其加载到我的系统上并收到外部环境消息。然后我意识到也许我安装了两个Python解释器......Geany一个和LO一个,并且LO python文件夹被挂锁......我很犹豫要不要下载tarball并将其粘贴在那里以防万一我破坏了某物。所以,我对从这里去哪里有点困惑。

python gspread libreoffice-calc
1个回答
0
投票

libreoffice/share/Scripts/Python directory
用于宏,而不是用于安装库。

每次使用 pip3 时如何解决“错误:外部管理环境”?的评论说此错误发生于

--user
。 LibreOffice 在 Ubuntu 上使用系统范围的 python3 发行版,因此只需尝试一下
pip3 install gspread

© www.soinside.com 2019 - 2024. All rights reserved.