Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python安装不再工作,报告找不到模块_Python_Python 2.7_Importerror - Fatal编程技术网

Python安装不再工作,报告找不到模块

Python安装不再工作,报告找不到模块,python,python-2.7,importerror,Python,Python 2.7,Importerror,我可能完全搞砸了Python 2.7.3的安装。我已经能够安装并运行Python2.7.3,所有导入工作正常 但当我尝试安装python dev时,我得到了以下结果: ritwik@ritwik-pc:~$ sudo apt-get install python-dev Reading package lists... Done Building dependency tree Reading state information... Done The following NEW

我可能完全搞砸了Python 2.7.3的安装。我已经能够安装并运行Python2.7.3,所有导入工作正常

但当我尝试安装python dev时,我得到了以下结果:

ritwik@ritwik-pc:~$ sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python-dev
0 upgraded, 1 newly installed, 0 to remove and 290 not upgraded.
5 not fully installed or removed.
Need to get 0 B/1,166 B of archives.
After this operation, 46.1 kB of additional disk space will be used.
Selecting previously unselected package python-dev.
(Reading database ... 168442 files and directories currently installed.)
Preparing to unpack .../python-dev_2.7.5-5ubuntu3_amd64.deb ...
Unpacking python-dev (2.7.5-5ubuntu3) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up python-colorama (0.2.5-0.1ubuntu1) ...
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
ImportError: No module named time
dpkg: error processing package python-colorama (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-distlib (0.1.8-1) ...
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
ImportError: No module named time
dpkg: error processing package python-distlib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-html5lib (0.999-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
ImportError: No module named time
dpkg: error processing package python-html5lib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-setuptools (3.3-1ubuntu1) ...
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
ImportError: No module named time
No apport report written because MaxReports is reached already
                                                              dpkg: error processing package python-setuptools (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-urllib3 (1.7.1-1build1) ...
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
ImportError: No module named time
dpkg: error processing package python-urllib3 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Setting up python-dev (2.7.5-5ubuntu3) ...
Errors were encountered while processing:
 python-colorama
 python-distlib
 python-html5lib
 python-setuptools
 python-urllib3
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果从命令行运行
python
,并在REPL处执行
import time
,是否会出现相同的错误?@Kevin import time从命令行开始工作您是否使用了系统python?谢谢您的编辑@skyterederubuntu,一旦你搞砸了系统,python对它的依赖性就太大了,如果可能的话,修复任何损坏的东西所需的时间将是重新安装和安装所需时间的20倍
ritwik@ritwik-pc:~$ sudo apt-get install codeblocks
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  codeblocks-common libcodeblocks0 libwxbase2.8-0 libwxgtk2.8-0
Suggested packages:
  libwxgtk2.8-dev wx-common codeblocks-contrib
The following NEW packages will be installed:
  codeblocks codeblocks-common libcodeblocks0 libwxbase2.8-0 libwxgtk2.8-0
0 upgraded, 5 newly installed, 0 to remove and 290 not upgraded.
5 not fully installed or removed.
Need to get 8,574 kB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/universe libwxbase2.8-0 amd64 2.8.12.1+dfsg-2ubuntu2 [460 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty/universe libwxgtk2.8-0 amd64 2.8.12.1+dfsg-2ubuntu2 [2,371 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu/ trusty/universe libcodeblocks0 amd64 13.12-3 [1,807 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu/ trusty/universe codeblocks-common all 13.12-3 [2,570 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu/ trusty/universe codeblocks amd64 13.12-3 [1,366 kB]
Fetched 8,574 kB in 2min 18s (62.0 kB/s)                                       
Selecting previously unselected package libwxbase2.8-0:amd64.
(Reading database ... 168449 files and directories currently installed.)
Preparing to unpack .../libwxbase2.8-0_2.8.12.1+dfsg-2ubuntu2_amd64.deb ...
Unpacking libwxbase2.8-0:amd64 (2.8.12.1+dfsg-2ubuntu2) ...
Selecting previously unselected package libwxgtk2.8-0:amd64.
Preparing to unpack .../libwxgtk2.8-0_2.8.12.1+dfsg-2ubuntu2_amd64.deb ...
Unpacking libwxgtk2.8-0:amd64 (2.8.12.1+dfsg-2ubuntu2) ...
Selecting previously unselected package libcodeblocks0.
Preparing to unpack .../libcodeblocks0_13.12-3_amd64.deb ...
Unpacking libcodeblocks0 (13.12-3) ...
Selecting previously unselected package codeblocks-common.
Preparing to unpack .../codeblocks-common_13.12-3_all.deb ...
Unpacking codeblocks-common (13.12-3) ...
Selecting previously unselected package codeblocks.
Preparing to unpack .../codeblocks_13.12-3_amd64.deb ...
Unpacking codeblocks (13.12-3) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.54ubuntu1) ...
Setting up python-colorama (0.2.5-0.1ubuntu1) ...
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
ImportError: No module named time
dpkg: error processing package python-colorama (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-distlib (0.1.8-1) ...
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
ImportError: No module named time
dpkg: error processing package python-distlib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-html5lib (0.999-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
ImportError: No module named time
dpkg: error processing package python-html5lib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-setuptools (3.3-1ubuntu1) ...
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
ImportError: No module named time
No apport report written because MaxReports is reached already
                                                              dpkg: error processing package python-setuptools (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-urllib3 (1.7.1-1build1) ...
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
ImportError: No module named time
dpkg: error processing package python-urllib3 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Setting up libwxbase2.8-0:amd64 (2.8.12.1+dfsg-2ubuntu2) ...
Setting up libwxgtk2.8-0:amd64 (2.8.12.1+dfsg-2ubuntu2) ...
Setting up libcodeblocks0 (13.12-3) ...
Setting up codeblocks-common (13.12-3) ...
Setting up codeblocks (13.12-3) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Errors were encountered while processing:
 python-colorama
 python-distlib
 python-html5lib
 python-setuptools
 python-urllib3
E: Sub-process /usr/bin/dpkg returned an error code (1)