简体   繁体   English

无法在Windows 32位上的Python 2.7中导入matplotlib

[英]Can't import matplotlib in Python 2.7 on Windows 32 bit

I have many error's when I import matplotlib in Python. 我在Python中导入matplotlib时遇到很多错误。 All the error's is from the program init .py of matplotlib 所有的错误来自于matplotlib的程序init .py

First: 第一:

So I download the whl file of this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#distribute Document: matplotlib-2.2.0rc1-cp27-cp27m-win32.whl 因此,我下载了该站点的whl文件: https ://www.lfd.uci.edu/~gohlke/pythonlibs/#distribute文档:matplotlib-2.2.0rc1-cp27-cp27m-win32.whl

I opened the CMD and did: Python -m pip install matplotlib-2.2.0rc1-cp27-cp27m-win32.whl 我打开了CMD并执行了以下命令:Python -m pip install matplotlib-2.2.0rc1-cp27-cp27m-win32.whl

This was succesfull (I tried the different versions but it give me always the same error's.) 这是成功的(我尝试了不同的版本,但是它总是给我相同的错误。)

So I opened Idle version 2.7.14 and tried to import matplotlib: 因此,我打开了空闲版本2.7.14,并尝试导入matplotlib:

import matplotlib

And this gives me this error's: 这给了我这个错误:

 Traceback (most recent call last):
  File "C:\Python27\j.py", line 1, in <module>
    import matplotlib
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 134, in <module>
    from six.moves.urllib.request import urlopen
ImportError: No module named urllib.request
>>> 

I don't understand why they give me error's in this program... By the way I supposed to work with python 2.7 not Python3 so this is not a solution... 我不明白为什么他们会在这个程序中给我错误...顺便说一句,我应该使用python 2.7而不是Python3,所以这不是解决方案...

Can someone help me? 有人能帮我吗?

To provide an answer useful for future readers: 为将来的读者提供有用的答案:

Matplotlib requires six 1.10 or higher to work correctly. Matplotlib需要六个1.10或更高版本才能正常工作。

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

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