Linux 如何在 Ubuntu 上安装当前的 OpenPYXL 包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17779810/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:20:00  来源:igfitidea点击:

How to install current OpenPYXL package on Ubuntu

pythonlinuxubuntuapt-getopenpyxl

提问by Larry Lustig

I have some spreadsheet reading code (using openpyxl) that works correctly on my Windows installation. On my Ubuntu Rackspace server, however, it fails with a named range error.

我有一些电子表格阅读代码(使用 openpyxl)可以在我的 Windows 安装上正常工作。然而,在我的 Ubuntu Rackspace 服务器上,它因命名范围错误而失败。

I notice that the openpyxl package on Ubuntu (which I installed last week using apt-get) is several years old (1.5.6). I'd like to install the newest version (1.6.2).

我注意到 Ubuntu 上的 openpyxl 包(我上周使用 apt-get 安装的)已经有好几年了(1.5.6)。我想安装最新版本 (1.6.2)。

What tool can I use to install the newer version, or is it something I need to do manually?

我可以使用什么工具来安装较新版本,还是需要手动执行?

采纳答案by Marius

The Python packages available in the Ubuntu repositories generally don't get updated within an Ubuntu version, only when you upgrade to a newer Ubuntu release.

Ubuntu 存储库中可用的 Python 包通常不会在 Ubuntu 版本中更新,只有在您升级到更新的 Ubuntu 版本时才会更新。

When you need newer versions of a Python package, you can use pipto get the newest version from the Python Package Index:

当您需要更新版本的 Python 包时,您可以使用pipPython 包索引中获取最新版本:

sudo pip install openpyxl

回答by Oleg Shkliaiev

Stuck on the same problem, this is what I did to fix it.

卡在同样的问题上,这就是我为解决它所做的。

On linux machines you need to install via apt package manager:

在 linux 机器上,您需要通过 apt 包管理器安装:

sudo apt-get install python-openpyxl python3-openpyxl