Не может использовать pip3 на Ubuntu 14.04

у меня есть зернышко и python2.7, установленный на Ubuntu, и они работают отлично. у меня есть установленный python3.6. каждый раз, когда я пытаюсь использовать pip3, я получаю ошибку:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'

и каждый раз, когда я работаю:

sudo apt-get install python3-pip

я получаю ошибки:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python3 (3.4.0-0ubuntu2) ...
running python rtupdate hooks for python3.4...
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook dh-python
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook gdebi-core
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook gdebi
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook ibus
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook onboard
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook python3-uno
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook rhythmbox-plugin-magnatune
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook rhythmbox-plugin-zeitgeist
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook rhythmbox-plugins
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook rhythmbox
E: py3compile:243: Requested versions are not installed
error running python rtupdate hook ubuntu-drivers-common
dpkg: error processing package python3 (--configure):
 subprocess installed post-installation script returned error exit status 4
dpkg: dependency problems prevent configuration of python3-pip:
 python3-pip depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-pip depends on python3; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pip (--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:
 python3
 python3-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)

я действительно нуждаюсь в помощи.спасибо!

после выполнения sudo apt-get install --reinstall python3-pkg-resources python3-minimal я добрался, ошибки... вот вывод;

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 17 not upgraded.
2 not fully installed or removed.
Need to get 54.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ng.archive.ubuntu.com/ubuntu/ trusty/main python3-minimal amd64 3.4.0-0ubuntu2 [23.2 kB]
Get:2 http://ng.archive.ubuntu.com/ubuntu/ trusty-updates/main python3-pkg-resources all 3.3-1ubuntu2 [31.7 kB]
Fetched 54.9 kB in 2s (25.7 kB/s)                
(Reading database ... 246854 files and directories currently installed.)
Preparing to unpack .../python3-minimal_3.4.0-0ubuntu2_amd64.deb ...
Unpacking python3-minimal (3.4.0-0ubuntu2) over (3.4.0-0ubuntu2) ...
Preparing to unpack .../python3-pkg-resources_3.3-1ubuntu2_all.deb ...
/var/lib/dpkg/info/python3-pkg-resources.prerm: 6: /var/lib/dpkg/info/python3-pkg-resources.prerm: py3clean: 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: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-pkg-resources_3.3-1ubuntu2_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python3-pkg-resources.postinst: 6: /var/lib/dpkg/info/python3-pkg-resources.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Processing triggers for man-db (2.7.0.2-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/python3-pkg-resources_3.3-1ubuntu2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Теперь... я действительно смущен. каждый раз, когда я пытаюсь установить что-либо, это дает ошибки. Ошибки как:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reinstallation of dh-python is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
4 not fully installed or removed.
Need to get 0 B/31.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python3-minimal (3.4.0-0ubuntu2) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: /var/lib/dpkg/info/python3-minimal.postinst: py3compile: not found
dpkg: error processing package python3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3-minimal (= 3.4.0-0ubuntu2); however:
  Package python3-minimal is not configured yet.

dpkg: error processing package python3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pkg-resources:
 python3-pkg-resources depends on python3:any (>= 3.4); however:
  Package python3 is not configured yet.
 python3-pkg-resources depends on python3:any (<< 3.5); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pkg-resources (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pip:
 python3-pip depends on python3-pkg-resources; however:
  Package python3-pkg-resources is not configured yet.
 python3-pip depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-pip depends on python3; however:
  Package pythNo 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
                                                on3 is not configured yet.

dpkg: error processing package python3-pip (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-minimal
 python3
 python3-pkg-resources
 python3-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
2
задан 17 February 2019 в 13:58

1 ответ

Во время разговора мы определили это py3compile и py3clean были повреждены из-за разорванной символьной связи между python3 и python3.4:

$ file /usr/bin/python3
/usr/bin/python3: broken symbolic link to `python3.4'

Таким образом, мы должны переустановить пакеты Python 3:

sudo apt-get install --reinstall libpython3.4 python3.4 python3-gdbm libpython3.4-stdlib libpython3.4-dev libpython3.4-minimal

И наконец переустановите весь другой материал, связанный с pkg_resources, py3compile и py3clean:

sudo apt-get install --reinstall python3-pkg-resources python3-minimal 
sudo apt-get install --reinstall dh-python

и затем повторите

sudo dpkg --configure -a
sudo apt-get install -f
sudo apt-get install python3-pip
sudo apt-get dist-upgrade
1
ответ дан 2 December 2019 в 04:39

Другие вопросы по тегам:

Похожие вопросы: