我正在运行 Ubuntu 23.04 和 Python 3.11.4
我想将 Tensorly 库安装到我的 Python 环境中。 Tensorly 说明要求使用 pip(或 Conda)。然而,当我这样做时,我看到了这条消息:
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.
如果我尝试通过 apt 安装它:
sudo apt install python3-tensorly
我得到:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-tensorly
我如何继续安装它?
如果您不熟悉 Python 生态系统,最简单的方法可能是仅安装 Anaconda 发行版(通常在本地)并在那里执行所有操作,而不是使用系统范围的 python 版本。
正如评论中提到的,在虚拟环境中工作是一个很好的做法。