win10上 Importing Matplotlib.pyplot:DLL load failed: %1 is not a valid Win32无效

Importing Matplotlib.pyplot:DLL load failed: %1 is not a valid Win32无效 这个错误坑爹的赤裸裸的坑了我好久好久,谷歌查了好多文档,终于被我搞定了。!!!!

 

就像这种 https://stackoverflow.com/questions/1052831/matplotlib-dll-load-failed-when-import-pylab

造成这个问题的原因,如网上所述的一样,64位的anaconda和 装了32位的Matplotlib 互相不兼容。

首先,如网上的所说的

环境:win10

要正确的选择python3.5 64bit的 anaconda~~

接着坑就来了,默认使用命令创建的anaconda的空间里面 自带的Matplotlib 是32位的 

 

命令如下:

conda create -n tensorflow python=3.5

 

进入相对应的空间

activate tensorflow

 

请不要用conda install 接着安装错误的Matplotlib ,请用pip,首先删除了不该存在的Matplotlib 

conda uninstall matplotlib

接着用pip安装,但是他会报红色的警告

Exception:
Traceback (most recent call last):
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\commands\install.py", line 335, in run
    wb.build(autobuilding=True)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
    require_hashes
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "C:\Users\yihua\Anaconda64\lib\site-packages\pip\index.py", line 731, in __init__
    namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'

请使用如下命令

conda install pip
pip uninstall matplotlib
pip install matplotlib

然后运行下就可以了

 

posted @ 2018-02-07 17:12  霏霏雪无声  阅读(348)  评论(0)    收藏  举报