Моя станция Linux была испорчена несколько прошлых дней. У меня было несколько версий Python, установленного, и он конфликтовал, пока я не начал повторно связывать и удалять некоторые установки. Я думаю, что заканчиваю тем, что портил вещи довольно плохо.
Когда я делаю a sudo apt-get upgrade
Я получаю следующее:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
python-pip : Depends: python:any (< 2.8)
Depends: python:any (>= 2.7.5-5~)
Recommends: python-all-dev (>= 2.6) but it is not installed
Recommends: python-setuptools but it is not installed
python-pkg-resources : Depends: python:any (< 2.8)
Depends: python:any (>= 2.7.5-5~)
python-wheel : Depends: python:any (< 2.8)
Depends: python:any (>= 2.7.5-5~)
E: Unmet dependencies. Try using -f.
Затем я выполняюсь sudo apt-get -f install
и я получаю следующее:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libpython-all-dev libpython-dev libpython2.7-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python
Suggested packages:
python-doc python-tk
The following NEW packages will be installed:
python
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
6 not fully installed or removed.
Need to get 0 B/137 kB of archives.
After this operation, 650 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.4) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/usr/bin/python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7-minimal (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of python-minimal:
python-minimal depends on python2.7-minimal (>= 2.7.12-1~); however:
Package python2.7-minimal is not configured yet.
dpkg: error processing package python-minimal (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
python2.7-minimal
python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
Кто-то может советовать?
Я выполнил следующие команды, как предложено в принятом ответе в Удаленном двоичный файл Python и не могу восстановиться, склонное использование - добираются, что я могу сделать?
apt-get download python2.7-minimal ## at least this package is necessary
sudo touch /usr/bin/python2.7 && sudo chmod +x /usr/bin/python2.7
sudo dpkg --unpack python2.7-minimal*
Затем я пытался сделать sudo apt-get -f install
и я добираюсь ниже:
dzdang@dzdang:~$ apt-get download python2.7-minimal
dzdang@dzdang:~$ dpkg: error: unknown option --check^C
dzdang@dzdang:~$ sudo touch /usr/bin/python2.7 && sudo chmod +x /usr/bin/python2.7
dzdang@dzdang:~$ sudo dpkg --unpack python2.7-minimal*
(Reading database ... 220776 files and directories currently installed.)
Preparing to unpack python2.7-minimal_2.7.12-1ubuntu0~16.04.4_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.4) over (2.7.12-1ubuntu0~16.04.4) ...
Processing triggers for man-db (2.7.5-1) ...
dzdang@dzdang:~$ sudo apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libpython-all-dev libpython-dev libpython2.7-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python
Suggested packages:
python-doc python-tk
The following NEW packages will be installed:
python
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
6 not fully installed or removed.
Need to get 0 B/137 kB of archives.
After this operation, 650 kB of additional disk space will be used.
Do you want to continue? [Y/n] yy
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.4) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/usr/bin/python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7-minimal (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of python-minimal:
python-minimal depends on python2.7-minimal (>= 2.7.12-1~); however:
Package python2.7-minimal is not configured yet.
dpkg: error processing package python-minimal (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
python2.7-minimal
python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
После выполнения
apt-get download libpython2.7-minimal && sudo dpkg --unpack libpython2.7-minimal*
выполнение sudo apt-get -f install
дает следующее:
dzdang@dzdang:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpython-all-dev libpython-dev libpython2.7-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python2.7 (2.7.12-1ubuntu0~16.04.4) ...
Traceback (most recent call last):
File "/usr/lib/python2.7/py_compile.py", line 181, in <module>
sys.exit(main())
File "/usr/lib/python2.7/py_compile.py", line 173, in main
compile(filename, doraise=True)
File "/usr/lib/python2.7/py_compile.py", line 106, in compile
with open(file, 'U') as f:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/poplib.py'
dpkg: error processing package python2.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python:
python depends on python2.7 (>= 2.7.12-1~); however:
Package python2.7 is not configured yet.
dpkg: error processing package python (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pip:
python-pip depends on python:any (<< 2.8); however:
Package python is not configured yet.
python-pip depends on python:any (>= 2.7.5-5~); however:
Package python is not configured yet.
dpkg: error processing package python-pip (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pkg-resources:
python-pkg-resources depends on python:any (<< 2.8); however:
Package python is not configured yet.
python-pkg-resources depends on python:any (>= 2.7.5-5~); however:
Package python is not configured yet.
dpkg: error processing package python-pkg-resources (--configure):
dependency problems - leaving unconfigurNo apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ed
dpkg: dependency problems prevent configuration of python-wheel:
python-wheel depends on python:any (<< 2.8); however:
Package python is not configured yet.
python-wheel depends on python:any (>= 2.7.5-5~); however:
Package python is not configured yet.
dpkg: error processing package python-wheel (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python2.7
python
python-pip
python-pkg-resources
python-wheel
E: Sub-process /usr/bin/dpkg returned an error code (1)
В изменении ответа Вы следовали за Вами, должен вручную загрузить и установить два других пакета:
apt download libpython2.7-{minimal,stdlib}
sudo dpkg --unpack libpython2.7-{minimal,stdlib}
После этого, sudo apt -f install
должен смочь разрешить дальше недостающие зависимости так, чтобы обычные команды как sudo apt upgrade
работайте снова.
apt download
хранит загруженный .deb
файлы в текущем каталоге. Безопасно удалить их после процесса:
rm *python2.7*.deb