简体   繁体   English

我无法安装matplotlib,错误消息为ModuleNotFoundError:没有名为“ html.parser”的模块; 'html'不是软件包

[英]I can't install matplotlib, error message says ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package

I followed the instructions from this site , but when I get to this step: 我遵循了本网站上的说明,但是当我执行此步骤时:

Copy the .whl file to your project folder, open a command window, and navigate to the project folder. 将.whl文件复制到您的项目文件夹,打开命令窗口,然后导航到项目文件夹。 Then use pip to install matplotlib: 然后使用pip安装matplotlib:

This error message appears: 出现此错误消息:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\distlib\scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\distlib\compat.py", line 85, in <module>
from html.parser import HTMLParser
ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package

I have Python 3.6.4 and the version of matplotlib I downloaded from this site is matplotlib-2.1.1-cp36-cp36m-win32.whl (md5) 我有Python 3.6.4,并且从该站点下载的matplotlib的版本是matplotlib-2.1.1-cp36-cp36m-win32.whl(md5)

EDIT: After installing Visual Basic and renaming the html file, the error message turned into this: 编辑:安装Visual Basic并重命名html文件后,错误消息变为:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\__init__.py", line 65, in <module>
from . import utils
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\utils.py", line 11, in <module>
import cgi
  File "C:\Users\myname\AppData\Local\Programs\Python\Python36-32\lib\cgi.py", line 42, in <module>
import html
ImportError: bad magic number in 'html': b'\xd1\xf2\r\n'

What do I do? 我该怎么办?

Be sure the html package is installed in your python-packages path: 确保将html软件包安装在python-packages路径中:

https://pypi.python.org/pypi/html https://pypi.python.org/pypi/html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM