2017-10-04 88 views
0

我读了很多网站和问题答案,但我总是得到同样的错误,无处找不到解决方案。 我的错误:如何使用python 2.7在debian上安装pip?

处理时的错误: python error python-crypto python-wheel python-pkg-resources python-keyrings.alt ptho-dbus python-pip python-xdg python-secretstorage python-keyring E:Sub-process /usr/bin/dpkg returned an error code(1)

我安装了Python 2.7.13到/usr/src/Python2.7.13

任何想法?

编辑 - Beomi:

sudo apt-get update -- done, working 
sudo apt-get upgrade -- not working, i get the errors what i wrote 
sudo apt-get -f install -- not working, i get the errors what i wrote 

我以下链接安装了Python 2.7.13:https://tecadmin.net/install-python-2-7-on-ubuntu-and-linuxmint/#

EDIT2 - Beomi:

[email protected]:/usr/src/Python-2.7.13$ sudo dpkg --configure -a 
Beállítás: python-crypto (2.6.1-7) ... 
Traceback (most recent call last): 
    File "/usr/bin/pycompile", line 26, in <module> 
    import logging 
    File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> 
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections 
    File "/usr/lib/python2.7/weakref.py", line 14, in <module> 
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref 
dpkg: error processing package python-crypto (--configure): 
installed post-installation script alfolyamat 1 hibakóddal kilépett 
Beállítás: python-wheel (0.29.0-2) ... 
Traceback (most recent call last): 
    File "/usr/bin/pycompile", line 26, in <module> 
    import logging 
    File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> 
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections 
    File "/usr/lib/python2.7/weakref.py", line 14, in <module> 
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref 
dpkg: error processing package python-wheel (--configure): 
installed post-installation script alfolyamat 1 hibakóddal kilépett 
dpkg: error processing package python-pkg-resources (--configure): 
package is in a very bad inconsistent state; you should 
reinstall it before attempting configuration 
dpkg: dependency problems prevent configuration of python-keyrings.alt: 
python-keyrings.alt függőségek: python-crypto; ám: 
    python-crypto csomag még beállítatlan. 

dpkg: error processing package python-keyrings.alt (--configure): 
függőségi hibák - e csomag beállítatlan maradt 
Beállítás: python-dbus (1.2.4-1+b1) ... 
Remove stale byte-compiled files... 
Traceback (most recent call last): 
    File "/usr/bin/pycompile", line 26, in <module> 
    import logging 
    File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> 
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections 
    File "/usr/lib/python2.7/weakref.py", line 14, in <module> 
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref 
dpkg: error processing package python-dbus (--configure): 
installed post-installation script alfolyamat 1 hibakóddal kilépett 
Beállítás: python-pip (9.0.1-2) ... 
Traceback (most recent call last): 
    File "/usr/bin/pycompile", line 26, in <module> 
    import logging 
    File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> 
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections 
    File "/usr/lib/python2.7/weakref.py", line 14, in <module> 
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref 
dpkg: error processing package python-pip (--configure): 
installed post-installation script alfolyamat 1 hibakóddal kilépett 
Beállítás: python-xdg (0.25-4) ... 
Traceback (most recent call last): 
    File "/usr/bin/pycompile", line 26, in <module> 
    import logging 
    File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> 
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections 
    File "/usr/lib/python2.7/weakref.py", line 14, in <module> 
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref 
dpkg: error processing package python-xdg (--configure): 
installed post-installation script alfolyamat 1 hibakóddal kilépett 
dpkg: dependency problems prevent configuration of python-secretstorage: 
python-secretstorage függőségek: python-dbus; ám: 
    python-dbus csomag még beállítatlan. 

dpkg: error processing package python-secretstorage (--configure): 
függőségi hibák - e csomag beállítatlan maradt 
dpkg: dependency problems prevent configuration of python-keyring: 
python-keyring függőségek: python-dbus; ám: 
    python-dbus csomag még beállítatlan. 
python-keyring függőségek: python-secretstorage; ám: 
    python-secretstorage csomag még beállítatlan. 

dpkg: error processing package python-keyring (--configure): 
függőségi hibák - e csomag beállítatlan maradt 
Hibák történtek a feldolgozáskor: 
python-crypto 
python-wheel 
python-pkg-resources 
python-keyrings.alt 
python-dbus 
python-pip 
python-xdg 
python-secretstorage 
python-keyring 

回答

0

至于你的问题不包括你到目前为止已经完成。

那么,如何修复你的apt包首先?

试试这个:

sudo apt-get update 
sudo apt-get upgrade 
sudo apt-get -f install 

,然后用sudo再试一次。

还有一个:如何安装Python与sudo apt-get install python

如果您确实需要最新版本的python 2.7,请在问题/评论中说明。

如果不工作,请更新问题和评论plz。

- 更新 -

由于sudo apt-get upgrade不工作,我还以为是什么问题PATH,系统默认蟒蛇VS新安装的蟒蛇。

- 更新-

这可能是debian iso文件的问题。

+0

编辑这些信息。 – Harley

+0

其中python:我得到这个 - >/usr/bin/python – Harley

+0

所以当你执行'python'时,那么它就是系统默认的python,而不是你安装的python。让我想想更多.. – Beomi

1

只要使用这个

sudo apt-get update 
sudo apt-get upgrade 
sudo apt-get install python-pip 

检查这个link更多信息

编辑:

检查This为好。这一点很重要。

编辑: 试试这个(src

sudo apt-get install python-pip 

也该(src

$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" 

$ python get-pip.py 
+0

用这些信息编辑,仍然无法正常工作。 – Harley

+0

链接说**警告最近的Debian/Ubuntu版本已经修改了点子默认情况下使用“用户方案”,这是一个重大的行为变化,可能会令一些用户感到惊讶** – TheTechGuy

+0

您是否也尝试过? – TheTechGuy

0

有一个名为get_pip.py在Python 2.7的文件,你能不能跑了,并检查? python get_pip.py在目标机器上。

+0

不,不存在 – Harley

0

只需

sudo apt-get install libssl-dev && 
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz && 
tar -xvf Python-2.7.13.tar.xz && 
cd Python-2.7.13 && 
./configure && sudo make && sudo make install 
+0

不只是这样。我也试过这个方法,但是我得到了同样的错误信息。 :( – Harley

+0

尝试清除蟒蛇并再次安装 – Juggernaut

+0

'sudo apt-get remove python2.7'? – Harley

相关问题