簡體   English   中英

如何使用python 2.7在debian上安裝pip?

[英]How to install pip on debian with python 2.7?

我讀了很多網站和問答,但總是遇到相同的錯誤,而且找不到解決方法。 我的錯誤:

處理時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 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:

web@debian:/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

只是用這個

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

檢查此鏈接以獲取更多信息

編輯:

也選中 這一點很重要。

編輯:嘗試這個( src

sudo apt-get install python-pip

也這個( src

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

$ python get-pip.py  

由於您的問題不包括您到目前為止所做的事情。

那么,如何首先修復您的apt軟件包呢?

嘗試這個:

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

然后使用sudo再試一次。

還有一個:如何使用sudo apt-get install python

如果您確實需要最新版本的python 2.7,請告訴我有問題/評論。

如果不起作用,請更新問題並發表評論。

-更新-

由於sudo apt-get upgrade不起作用,我認為PATH會出現問題,系統默認python與新安裝的python相對。

-更新-

這可能是debian iso文件的問題。

python 2.7中有一個名為get_pip.py的文件,您可以運行它並檢查嗎? 目標機器中的python get_pip.py。

只是

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM