ImportError:无法导入名称HTMLParser

时间:2018-06-20 18:01:59

标签: python python-2.7 pip

我是python新手,出现以下错误:

  <script>
    function newRow(msg) {
        alert(msg.status)
        switch (msg.status) {
            case 'Safe':
                 var tr = '<tr class="c_table">' + '<td>' + msg.file_name + '</td>' + '<td>' + msg.status + '</td>' + '<td>' + msg.time + '</td></tr>';
                 $('#c_table').append(tr);
                 break;
            case 'Threat':
                 var tr = '<tr class="c_table">' + '<td>' + msg.file_name + '</td>' + '<td>' + msg.status + '</td>' + '<td>' + msg.time + '</td></tr>';
                 $('#c_table').append(tr);
                 break;
            case 'Queued':
                 var tr = '<tr class="p_table">' + '<td>' + msg.file_name + '</td>'  + '<td>' + msg.status + '</td>' + '<td>' + msg.time + '</td></tr>';
                 $('#p_table').append(tr);
                 break;
        }
    }
  </script>  

C:\infinidat_aptare>pip install --upgrade infi.projector infi.recipe.application_package    
Traceback (most recent call last):  
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main  
    "__main__", fname, loader, pkg_name)  
  File "c:\python27\lib\runpy.py", line 72, in _run_code  
    exec code in run_globals  
  File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>  
  File "c:\python27\lib\site-packages\pip\_internal\__init__.py", line 42, in   <module>
    from pip._internal import cmdoptions  
  File "c:\python27\lib\site-packages\pip\_internal\cmdoptions.py", line 16, in <module>
    from pip._internal.index import (  
  File "c:\python27\lib\site-packages\pip\_internal\index.py", line 16, in <module>  
    from pip._vendor.distlib.compat import unescape  
  File "c:\python27\lib\site-packages\pip\_vendor\distlib\compat.py", line 45, in <module>  
    from HTMLParser import HTMLParser  
ImportError: cannot import name HTMLParser  

我什至尝试从python shell导入它:

C:\>pip --version   
Traceback (most recent call last):  
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main  
    "__main__", fname, loader, pkg_name)  
  File "c:\python27\lib\runpy.py", line 72, in _run_code  
    exec code in run_globals  
  File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>  
  File "c:\python27\lib\site-packages\pip\_internal\__init__.py", line 42, in <module>  
    from pip._internal import cmdoptions  
  File "c:\python27\lib\site-packages\pip\_internal\cmdoptions.py", line 16, in <module>  
    from pip._internal.index import (  
  File "c:\python27\lib\site-packages\pip\_internal\index.py", line 16, in <module>  
    from pip._vendor.distlib.compat import unescape  
  File "c:\python27\lib\site-packages\pip\_vendor\distlib\compat.py", line 45, in <module>  
    from HTMLParser import HTMLParser  
ImportError: cannot import name HTMLParser  

我所做的唯一更改是在Windows机器上安装了“ pip install pythonwpy”,之前一切正常。

请帮助我。

操作系统版本:Windows Server 2008 R2 Enterprise

Python版本:2.7.8

0 个答案:

没有答案