1
crazycabbage 2018-08-11 10:50:29 +08:00 via iPhone
1.难道没有自带 pip3 吗?我用的 debian9 表示一切良好。
2.从报错信息来看 ``` from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-apt (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of apt-listchanges: apt-listchanges depends on python-apt (>= 0.7.93); however: Package python-apt is not configured yet. ``` 这里可以看出` ImportError: No module named 'ConfigParser'`这个是 Python2 才有的 module,这里可能是系统的 Python 被链接到了 Python3 而不 Python2 导致的,可以检查一下是不是默认 Python 是 3 而不是 2。 |
2
h19981126g OP @crazycabbage 呃,我 update-alternatives --list 列出只有 python3.4,默认输入 python 打开的是 python3,但 python2 也能打开 python2.7.9,这要怎么搞?
|
3
likuku 2018-08-11 11:10:53 +08:00 via iPhone
pyenv 最棒了
|
4
crazycabbage 2018-08-11 11:13:45 +08:00 via iPhone
@h19981126g 去 /usr/bin 中把 Python 链接到 Python2
|
5
h19981126g OP @likuku Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 28, in <module> import apt_pkg ImportError: No module named 'apt_pkg' Preconfiguring packages ... (Reading database ... 41918 files and directories currently installed.) Preparing to unpack .../libssl-dev_1.0.1t-1+deb8u9_amd64.deb ... Unpacking libssl-dev:amd64 (1.0.1t-1+deb8u9) over (1.0.1t-1+deb8u8) ... Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u9_amd64.deb ... Unpacking libssl1.0.0:amd64 (1.0.1t-1+deb8u9) over (1.0.1t-1+deb8u8) ... Selecting previously unselected package libreadline6-dev:amd64. Preparing to unpack .../libreadline6-dev_6.3-8+b3_amd64.deb ... Unpacking libreadline6-dev:amd64 (6.3-8+b3) ... Selecting previously unselected package libreadline-dev:amd64. Preparing to unpack .../libreadline-dev_6.3-8+b3_amd64.deb ... Unpacking libreadline-dev:amd64 (6.3-8+b3) ... Selecting previously unselected package libsqlite3-dev:amd64. Preparing to unpack .../libsqlite3-dev_3.8.7.1-1+deb8u2_amd64.deb ... Unpacking libsqlite3-dev:amd64 (3.8.7.1-1+deb8u2) ... Processing triggers for install-info (5.2.0.dfsg.1-6) ... Setting up python-apt (0.9.3.12) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-apt (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of apt-listchanges: apt-listchanges depends on python-apt (>= 0.7.93); however: Package python-apt is not configured yet. dpkg: error processing package apt-listchanges (--configure): dependency problems - leaving unconfigured Setting up python-ply (3.4-5) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-ply (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of python-pycparser: python-pycparser depends on python-ply (>= 3.2); however: Package python-ply is not configured yet. python-pycparser depends on python-ply (<< 3.5) | python-ply-yacc-3.2; however: Package python-ply is not configured yet. Package python-ply-yacc-3.2 is not installed. Package python-ply which provides python-ply-yacc-3.2 is not configured yet. python-pycparser depends on python-ply-lex-3.2; however: Package python-ply-lex-3.2 is not installed. Package python-ply which provides python-ply-lex-3.2 is not configured yet. dpkg: error processing package python-pycparser (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python-cffi: python-cffi depends on python-pycparser; however: Package python-pycparser is not configured yet. dpkg: error processing package python-cffi (--configure): dependency problems - leaving unconfigured Setting up python-colorama (0.3.2-1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-colorama (--configure): subprocess installed post-installation script returned error exit status 1 Setting up libssl1.0.0:amd64 (1.0.1t-1+deb8u9) ... Setting up libssl-dev:amd64 (1.0.1t-1+deb8u9) ... dpkg: dependency problems prevent configuration of python-cryptography: python-cryptography depends on python-cffi; however: Package python-cffi is not configured yet. dpkg: error processing package python-cryptography (--configure): dependency problems - leaving unconfigured Setting up python-distlib (0.1.9-1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-distlib (--configure): subprocess installed post-installation script returned error exit status 1 Setting up python-html5lib (0.999-3) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-html5lib (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of python-openssl: python-openssl depends on python-cryptography; however: Package python-cryptography is not configured yet. dpkg: error processing package python-openssl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python-ndg-httpsclient: python-ndg-httpsclient depends on python-openssl; however: Package python-openssl is not configured yet. dpkg: error processing package python-ndg-httpsclient (--configure): dependency problems - leaving unconfigured Setting up python-urllib3 (1.16-1+deb8u1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-urllib3 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of python-requests: python-requests depends on python-urllib3 (>= 1.16); however: Package python-urllib3 is not configured yet. python-requests depends on python-urllib3 (<< 1.16.1); however: Package python-urllib3 is not configured yet. dpkg: error processing package python-requests (--configure): dependency problems - leaving unconfigured Setting up python-setuptools (5.5.1-1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-setuptools (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of python-pip: python-pip depends on python-colorama; however: Package python-colorama is not configured yet. python-pip depends on python-distlib; however: Package python-distlib is not configured yet. python-pip depends on python-html5lib; however: Package python-html5lib is not configured yet. python-pip depends on python-requests; however: Package python-requests is not configured yet. python-pip depends on python-setuptools (>= 0.6c1); however: Package python-setuptools is not configured yet. dpkg: error processing package python-pip (--configure): dependency problems - leaving unconfigured Setting up python-pyasn1 (0.1.7-1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-pyasn1 (--configure): subprocess installed post-installation script returned error exit status 1 Setting up python-wheel (0.24.0-1) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-wheel (--configure): subprocess installed post-installation script returned error exit status 1 Setting up libreadline6-dev:amd64 (6.3-8+b3) ... Setting up libreadline-dev:amd64 (6.3-8+b3) ... Setting up libsqlite3-dev:amd64 (3.8.7.1-1+deb8u2) ... Processing triggers for libc-bin (2.19-18+deb8u7) ... Errors were encountered while processing: python-apt apt-listchanges python-ply python-pycparser python-cffi python-colorama python-cryptography python-distlib python-html5lib python-openssl python-ndg-httpsclient python-urllib3 python-requests python-setuptools python-pip python-pyasn1 python-wheel E: Sub-process /usr/bin/dpkg returned an error code (1) 如你所见的报错 No module named 'apt_pkg' |
6
h19981126g OP @crazycabbage 改回了,我需要用 python3 的库怎么办
|
7
affyun 2018-08-11 11:31:34 +08:00 via Android
Python3 的 pip 有 pip3,你是要折腾什么?
apt install python3-pip |
8
thedog 2018-08-11 11:33:46 +08:00 via Android
装个 miniconda 吧
|
9
h19981126g OP |
10
SimonFu 2018-08-11 11:40:39 +08:00
|
11
mazyi 2018-08-11 11:48:31 +08:00 via iPhone
apt-get 不好用咩
|
12
likuku 2018-08-11 12:28:55 +08:00
经验: 系统自带 python 不要去碰它了,先装好 pyenv,用 pyenv 来安装自己想要的 python2.x 3.x
|
13
likuku 2018-08-11 12:30:33 +08:00
我 debian8 下就是按 #12 方式来安装 python3 来跑 flask + gunicorn 的
|
14
Showfom 2018-08-11 12:55:29 +08:00 via iPhone
Debian 8 已经不更新了 只有安全更新 建议换 Debian 9 或 10
|
15
Rehtt 2018-08-11 12:59:23 +08:00 via Android
试试
apt install pytgon3-pip |
16
Tink 2018-08-11 15:29:43 +08:00 via iPhone
现在已经装废了,重装吧
|
17
chesterzzy 2018-08-11 15:38:43 +08:00
anaconda 多省事儿
|
18
izoabr 2018-08-11 23:16:44 +08:00
@crazycabbage 吓得我赶紧去查了一下文档,因为刚刚帮别人写了一个 PY3 的东西,为了方便里面用了 configparser,我本地运行没问题,就给人家了。。。
https://docs.python.org/3/library/configparser.html |
19
dontaskcece 2018-08-12 01:33:11 +08:00
pyenv
|