问题描述
我在 ChromeOS 上的“Linux 开发环境”中,我需要安装 3.7.7 之后的 Python 版本才能使用包(因为我的默认 Python 版本是 3.7.3)。 我试过了
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3
但是得到了
python3 is already the newest version (3.7.3-1).
python3 set to manually installed.
0 upgraded,0 newly installed,0 to remove and 0 not upgraded.
当我尝试安装高于 3.7 的版本时,例如 3.9,我得到了
E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'
E: Couldn't find any package by regex 'python3.9'
当我使用 aptitude 而不是 apt 时,我遇到了同样的问题。
我也尝试过从源代码构建或使用 ppa(deadsnakes),这似乎是正统的修复方法,但在此设备上均无效。你能帮我使用 apt 或任何其他包管理器安装新版本吗?
解决方法
要在 debian 上通过 def main():
# [...]
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
bullet_group.add(player.create_bullet())
# [...]
安装 python3.9,您需要将 debian 版本升级到 apt
。
您可以按照 my answer on unix.stackexchange.com
在 Debian Buster 上构建 python3.9只需将 bullseye
命令替换为:
wget