使用matplotlib时出错

时间:2013-10-17 05:29:58

标签: python matplotlib

我想在我的python程序中使用matplotlib。但我得到了跟随错误。那是什么?

      import matplotlib.pyplot as plt
      File "C:\Program Files\Python27\lib\site-packages\matplotlib\pyplot.py", line
    24, in <module>
        import matplotlib.colorbar
      File "C:\Program Files\Python27\lib\site-packages\matplotlib\colorbar.py", lin
    e 29, in <module>
        import matplotlib.collections as collections
      File "C:\Program Files\Python27\lib\site-packages\matplotlib\collections.py",
    line 23, in <module>
        import matplotlib.backend_bases as backend_bases
      File "C:\Program Files\Python27\lib\site-packages\matplotlib\backend_bases.py"
    , line 50, in <module>
        import matplotlib.textpath as textpath
      File "C:\Program Files\Python27\lib\site-packages\matplotlib\textpath.py", lin
    e 5, in <module>
        import urllib
      File "C:\Program Files\Python27\lib\urllib.py", line 26, in <module>
        import socket
      File "C:\Program Files\Python27\lib\socket.py", line 47, in <module>
        import _socket
   ImportError: No module named _socket

1 个答案:

答案 0 :(得分:0)

尝试将“C:\ [PythonDir] \ DLLs”添加到PYTHONPATH环境变量中。这应该解决问题