我的Linux Mint 13 64位系统出现了问题.虽然我可以运行像ls和vi这样的基本命令,如果我尝试更复杂的东西(我已经尝试过python2.7,mysql-workbench和addusr),我得到: –
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
我去了另一个系统(Mint 13 32位)并运行:
# echo $PYTHONHOME,
得到一个空白,所以不知道是什么
<prefix>[:<exec_prefix>]
是?
不确定下一步去哪儿?
进一步谷歌搜索后,我尝试了“sudo dpkg -configure -a”和“sudo apt-get install -f”,结果如下: –
HP-255-G1 # sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of python-appindicator:
python-appindicator depends on libappindicator1 (= 0.4.92-0ubuntu1);
however:
Version of libappindicator1 on system is 0.4.92-0ubuntu1.1.
dpkg: error processing python-appindicator (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-uno:
python-uno depends on libreoffice-core (= 1:3.5.2-2ubuntu1); however:
Version of libreoffice-core on system is 1:3.5.7-0ubuntu7.
dpkg: error processing python-uno (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-appindicator
python-uno
HP-255-G1 # sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
python-appindicator python-uno
The following packages will be upgraded:
python-appindicator python-uno
2 upgraded, 0 newly installed, 0 to remove and 690 not upgraded.
2 not fully installed or removed.
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/
所以看起来好像“python-uno”和“python-appindicator”是一些问题的中心,但到现在为止?
这是请求的输出: –
HP-255-G1# apt-cache policy python-uno python-appindicator
python-uno:
Installed: 1:3.5.2-2ubuntu1
Candidate: 1:3.5.7-0ubuntu7
Version table:
1:3.5.7-0ubuntu7 0
500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
*** 1:3.5.2-2ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
python-appindicator:
Installed: 0.4.92-0ubuntu1
Candidate: 0.4.92-0ubuntu1.1
Version table:
0.4.92-0ubuntu1.1 0
500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
*** 0.4.92-0ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
我设法从命令行运行Synaptic Package Manager并尝试更新python-uno和python-appindicator.这失败但希望输出(下图)是另一条线索: –
E: /var/cache/apt/archives/python-appindicator_0.4.92-0ubuntu1.1_amd64.deb:
subprocess new pre-removal script returned error exit status 1
E: /var/cache/apt/archives/python-uno_1%3a3.5.7-0ubuntu7_amd64.deb:
subprocess new pre-removal script returned error exit status 1
解决方法:
在与聊天海报讨论后,从http://chat.stackexchange.com/transcript/message/20047753#20047753开始,结果发现海报的机器缺少/usr/lib/python2.7,见http://chat.stackexchange.com/transcript/message/20052960#20052960.这解释了海报的大部分问题.特别是错误:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
源于这些遗失的图书馆.
接下来要做的是恢复/usr/lib/python2.7下的基础Python库.一种方法是下载对应于python2.7,python2.7-minimal和libpython2.7的deb文件,然后使用dpkg -i安装它们.即
apt-get download python2.7 python2.7-minimal libpython2.7
dpkg -i python*.deb
一旦完成,希望包装系统将停止吓坏.然后安装debsums(如果尚未安装),并使用debsums -as恢复剩余的丢失文件.