无法在Ubuntu 14.04上使用pip3。

我在Ubuntu上安装了pip和Python2.7,并且它们运行得很完美。我也安装了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)
1个回答

在聊天会话中,我们确定了py3compilepy3clean之间的符号链接损坏,因为python3python3.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_resourcespy3compilepy3clean相关的所有其他内容。
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

尝试重新安装python3-pkg-resources和python3-minimal后,我遇到了一个错误。 - Viqtoh
处理过程中遇到错误:/var/cache/apt/archives/python3-pkg-resources_3.3-1ubuntu2_all.deb - Viqtoh
编辑您的问题,并填写执行命令的完整错误输出。 - N0rbert
我无法安装... dpkg 一直在尝试处理 python3-pip(--configure)。 - Viqtoh
我仍然遇到像Errors encountered while processing: /var/cache/apt/archives/python3-pip_1.5.4-1ubuntu4_all.deb这样的错误。 - Viqtoh
我在聊天会话中更新了答案,并提供了实际解决方案。请考虑接受它,并删除您上方的评论。 - N0rbert
对不起,Norbert...我已经开始备份所有的个人文件并重新安装了干净的Ubuntu。无论如何,还是谢谢你的帮助。 - Viqtoh