尝试安装 python-pygame 时处理包时出错

尝试安装 python-pygame 时处理包时出错

无论我尝试使用 apt-get install 安装什么,它都不起作用。

我从昨天开始使用 Elementary OS(基于 Ubuntu),所以我对 Linux 还很陌生。

下面是我的问题的一个例子:

$ sudo apt-get install python-pygame
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-pygame is already the newest version.
The following extra packages will be installed:
  apport kde-l10n-engb python-urllib3
Suggested packages:
  apport-gtk apport-kde
Recommended packages:
  apport-symptoms
The following packages will be upgraded:
  apport kde-l10n-engb python-urllib3
3 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
19 not fully installed or removed.
Need to get 0 B/2.537 kB of archives.
After this operation, 9.875 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 209029 files and directories currently installed.)
Preparing to unpack .../apport_2.14.1-0ubuntu3.10_all.deb ...
apport stop/waiting
/var/lib/dpkg/info/apport.prerm: 14: /var/lib/dpkg/info/apport.prerm: pyclean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 14: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found
dpkg: error processing archive /var/cache/apt/archives/apport_2.14.1-0ubuntu3.10_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apport.postinst: 13: /var/lib/dpkg/info/apport.postinst: pycompile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../kde-l10n-engb_4%3a4.13.0-0ubuntu1_all.deb ...
Unpacking kde-l10n-engb (4:4.13.0-0ubuntu1) over (4:4.13.0-0ubuntu1) ...
Preparing to unpack .../python-urllib3_1.7.1-1ubuntu3_all.deb ...
/var/lib/dpkg/info/python-urllib3.prerm: 6: /var/lib/dpkg/info/python-urllib3.prerm: pyclean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found
dpkg: error processing archive /var/cache/apt/archives/python-urllib3_1.7.1-1ubuntu3_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python-urllib3.postinst: 6: /var/lib/dpkg/info/python-urllib3.postinst: pycompile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/apport_2.14.1-0ubuntu3.10_all.deb
 /var/cache/apt/archives/python-urllib3_1.7.1-1ubuntu3_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

我遇到了同样的问题。由于某种原因,您无法直接使用安装 pygame 包apt-get。我建议您访问 pygame 的网站下载部分并下载pygame-1.9.1release.tar.gz(或任何稳定版本)。

打开终端并导航到下载的文件夹。解压文件,假设你在Downloads目录中

tar -xvf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release   #navigate to the extracted directory

并运行以下命令来安装该包。

sudo python Setup.py

这应该会为您安装 pygame 包。

或者,你可以从以下网址下载 pygame 的稳定版本此链接适用于 AMD 架构和这里对于 i386 作为 deb 包并使用

sudo dpkg -i packagename

相关内容