我遇到了一个问题(问题 199582) 已解决。不幸的是,我现在被困在这一点上了。
跑步
root@X100e:/var/cache/apt/archives# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
file libexpat1 libmagic1 libreadline6 libsqlite3-0 mime-support python python-minimal python2.6 python2.6-minimal readline-common
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/5,204kB of archives.
After this operation, 19.7MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 6108 files and directories currently installed.)
Unpacking python2.6-minimal (from .../python2.6-minimal_2.6.6-5ubuntu1_i386.deb) ...
new installation of python2.6-minimal; /usr/lib/python2.6/site-packages is a directory
which is expected a symlink to /usr/local/lib/python2.6/dist-packages.
please find the package shipping files in /usr/lib/python2.6/site-packages and
file a bug report to ship these in /usr/lib/python2.6/dist-packages instead
aborting installation of python2.6-minimal
dpkg: error processing /var/cache/apt/archives/python2.6-minimal_2.6.6-5ubuntu1_i386.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/python2.6-minimal_2.6.6-5ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
导致上述错误。
跑步
root@X100e:/var/cache/apt/archives# dpkg -i python2.6-minimal_2.6.6-5ubuntu1_i386.deb
(Reading database ... 6108 files and directories currently installed.)
Unpacking python2.6-minimal (from python2.6-minimal_2.6.6-5ubuntu1_i386.deb) ...
new installation of python2.6-minimal; /usr/lib/python2.6/site-packages is a directory
which is expected a symlink to /usr/local/lib/python2.6/dist-packages.
please find the package shipping files in /usr/lib/python2.6/site-packages and
file a bug report to ship these in /usr/lib/python2.6/dist-packages instead
aborting installation of python2.6-minimal
dpkg: error processing python2.6-minimal_2.6.6-5ubuntu1_i386.deb (--install):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
python2.6-minimal_2.6.6-5ubuntu1_i386.deb
导致上述错误。
跑步
root@X100e:/var/cache/apt/archives# dpkg -i --force-depends python2.6-minimal_2.6.6-5ubuntu1_i386.deb
(Reading database ... 6108 files and directories currently installed.)
Unpacking python2.6-minimal (from python2.6-minimal_2.6.6-5ubuntu1_i386.deb) ...
new installation of python2.6-minimal; /usr/lib/python2.6/site-packages is a directory
which is expected a symlink to /usr/local/lib/python2.6/dist-packages.
please find the package shipping files in /usr/lib/python2.6/site-packages and
file a bug report to ship these in /usr/lib/python2.6/dist-packages instead
aborting installation of python2.6-minimal
dpkg: error processing python2.6-minimal_2.6.6-5ubuntu1_i386.deb (--install):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
python2.6-minimal_2.6.6-5ubuntu1_i386.deb
无法修复此问题。
有什么线索可以解决这个问题吗?
答案1
错误消息抱怨说这/usr/lib/python2.6/site-packages
是一个目录,但应该是符号链接。最可能的解释是,您安装的一些软件包不符合当前的 Python 打包策略(额外的软件包放入/usr/lib/python2.6/dist-packages
),而是将文件放入/usr/lib/python2.6/site-packages
。
运行dpkg -S /usr/lib/python2.6/site-packages
以查看哪些软件包不符合当前政策。错误消息会提示您报告这些软件包的错误。
简单的解决办法是删除有问题的软件包。
另一种可能性是,您/usr/lib/python2.6/dist-packages
没有通过 deb 包管理器就安装了 中的程序。在这种情况下,请将这些东西移至/usr/local/lib/python2.6/dist-packages
。一般来说,您不应该在 中安装或更改任何东西,/usr
除非通过调用dpkg
它的或更高级的程序(apt-get
、aptitude
、 Synaptic 等)。例外是/usr/local
,您可以在其中执行任何您想做的事情。如果dpkg -S /usr/lib/python2.6/site-packages
告诉您没有软件包在该目录下安装任何文件,您只需将目录移动到它应该在的位置:
mv /usr/lib/python2.6/site-packages /usr/local/lib/python2.6/dist-packages
或者如果目标目录已经存在:
mv -i /usr/lib/python2.6/site-packages/* /usr/local/lib/python2.6/dist-packages/
rmdir /usr/lib/python2.6/site-packages
如果您有想要保留安装的旧策略包,我认为您可以使用以下解决方法:
mkdir -p /usr/local/lib/python2.6/dist-packages
mv -i /usr/lib/python2.6/site-packages/* /usr/local/lib/python2.6/dist-packages
rmdir /usr/lib/python2.6/site-packages
ln -s /usr/local/lib/python2.6/dist-packages /usr/lib/python2.6/site-packages
如果mv
命令抱怨某些目标已经存在,则需要根据具体情况解决。
如果您确实使用了该解决方法,请做好心理准备,因为如果您在 中安装非 deb python 包/usr/local
,则会造成相当大的混乱,因为/usr/local/lib/python2.6/dist-packages
将包含一些由 dpkg 管理的文件。另外,我并不完全确定这不会导致任何包管理问题,例如,如果您稍后升级或删除有问题的包,则会出现错误。只有当您准备好稍后进行更多故障排除时,才尝试该解决方法。同样,安全的选择是在升级包之前删除有问题的包python
。