简体   繁体   English

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

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

I read many website and question-answer, but i get always the same error, and nowhere I can't find the solution. 我读了很多网站和问答,但总是遇到相同的错误,而且找不到解决方法。 My errors: 我的错误:

Errors while processings: 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 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)

I installed Python 2.7.13 to /usr/src/Python2.7.13 我将Python 2.7.13安装到/usr/src/Python2.7.13

Any ideas? 有任何想法吗?

Edit - Beomi : 编辑-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

I installed Python 2.7.13 following this link: https://tecadmin.net/install-python-2-7-on-ubuntu-and-linuxmint/# 我通过以下链接安装了Python 2.7.13: https : //tecadmin.net/install-python-2-7-on-ubuntu-and-linuxmint/#

Edit2 - Beomi : 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

Just use this 只是用这个

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

Check this link for more info 检查此链接以获取更多信息

EDIT: 编辑:

Check This as well. 也选中 This is important to know. 这一点很重要。

Edit : Try this ( src ) 编辑:尝试这个( src

sudo apt-get install python-pip

also This ( src ) 也这个( src

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

$ python get-pip.py  

As your question doesn't include what you have done so far.. 由于您的问题不包括您到目前为止所做的事情。

so, How about fix your apt packages first? 那么,如何首先修复您的apt软件包呢?

Try this: 尝试这个:

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

and then try again with sudo . 然后使用sudo再试一次。

And one more: How about install python with sudo apt-get install python ? 还有一个:如何使用sudo apt-get install python

If you really need latest version of python 2.7, plz tell in question/comment. 如果您确实需要最新版本的python 2.7,请告诉我有问题/评论。

If not working, please update question and comment plz. 如果不起作用,请更新问题并发表评论。

-- Update -- -更新-

As sudo apt-get upgrade not working, I thought there'd be problem with PATH , system default python vs new-installed python. 由于sudo apt-get upgrade不起作用,我认为PATH会出现问题,系统默认python与新安装的python相对。

-- Update -- -更新-

It could be problem of debian iso file. 这可能是debian iso文件的问题。

There is a file called get_pip.py in the python 2.7 , can you ran that and check ? python 2.7中有一个名为get_pip.py的文件,您可以运行它并检查吗? python get_pip.py in the target machine. 目标机器中的python get_pip.py。

Simply 只是

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