linux在执行apt-get的时候出现大量的如下错误:
dpkg: warning: files list file for package `libxau6' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `liblockfile1' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libkrb5-3' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libwrap0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libcap2' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libxt6' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libgomp1' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libglib2.0-0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `mcollective-puppet-common' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libmpfr4' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libpcsclite1' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libstdc++6' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `icedtea-6-jre-cacao' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libxcursor1' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libhunspell-1.3-0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libgmp10' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libpixman-1-0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libpng12-0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libsm6' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libc6' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libtalloc2' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `gcc-4.6-base' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libselinux1' missing, assuming package has no files currently installed.
我是用如下的脚本解决问题的:
import re
import os
def main():
os.system('sudo apt-get install sl > out')
txt = ""
with open("out") as f:
txt = f.read()
p = re.compile(r"`.*'")
out = p.findall(txt)
str1 = ""
for i in out:
str1 += "sudo apt-get install --reinstall -y " + i[1:-1] + "\n"
with open("clean.sh",'w') as f:
f.write(str1)
os.system('chomd +X clean.sh')
os.system('sh ./clean.sh')
os.remove('out')
if __name__ == "__main__":
main()