【发布时间】:2020-12-06 23:09:54
【问题描述】:
我试过“apt-get install python-mysqldb”,结果是:
root@ps1svr:~# apt-get install python-mysqldb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-mysqldb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-mysqldb' has no installation candidate
注意:“apt-get install python3-mysqldb”有效,但是我有很多为 Python 2.x 编写的代码不再运行,这导致了很多问题,我可能不得不重新安装Ubuntu 18.04
【问题讨论】:
-
您是否尝试过在运行安装之前运行“apt-get update”?
-
你不应该期望获得对 Python 2 的任何支持。它已在今年年初达到生命的尽头。你应该专注于让你的代码与 Python 3 一起工作。
-
谢谢帕特里克,但我在运行安装之前做了“apt-get update”。
-
谢谢 mkrieger1,我知道 Python 2.x 已经到了生命周期的尽头,但我在一个我们有很多计算机的环境中工作,运行各种版本的 Linux。一些最古老的嵌入式系统与中型 (1.8m) 望远镜相关联,因此两个弊端中较小的一个将是回滚到 Ubuntu 18.04 并继续使用它,而不是重写所有内容以使用 Python 3。跨度>
-
这个页面可能会让人们相信 python-mysqldb 可能在 20.04 可用:(ubuntuupdates.org/package/core/focal/main/base/python-mysqldb)
标签: python-2.7 ubuntu mysql-python