将matplotlib导入为plt(UnicodeDecode错误)

时间:2018-02-05 18:51:17

标签: python matplotlib

全新的python。我已经找到了这个问题,但那里的材料远远超出了我的脑海。我希望我有一个更具体的问题,这个'追溯'? (回溯是错误代码?)。

当我尝试"将matplotlib导入为plt"时出现以下问题。从对此问题的研究来看,它可能是一个带有e'或o:或那种性质的东西?我是否需要在文件夹结构中删除文件?

我和Anaconda2一起建立了Jupyter。据我所知,它使用的是python 3.5。操作系统是Windows 7.

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-9-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\pyplot.py in <module>()
     27 from cycler import cycler
     28 import matplotlib
---> 29 import matplotlib.colorbar
     30 from matplotlib import style
     31 from matplotlib import _pylab_helpers, interactive

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\colorbar.py in <module>()
     32 import matplotlib.artist as martist
     33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
     35 import matplotlib.colors as colors
     36 import matplotlib.contour as contour

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\collections.py in <module>()
     25 import matplotlib.artist as artist
     26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
     28 import matplotlib.path as mpath
     29 from matplotlib import _path

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\backend_bases.py in <module>()
     60 
     61 import matplotlib.tight_bbox as tight_bbox
---> 62 import matplotlib.textpath as textpath
     63 from matplotlib.path import Path
     64 from matplotlib.cbook import mplDeprecation, warn_deprecated

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\textpath.py in <module>()
     13 from matplotlib.path import Path
     14 from matplotlib import rcParams
---> 15 import matplotlib.font_manager as font_manager
     16 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
     17 from matplotlib.ft2font import LOAD_TARGET_LIGHT

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in <module>()
   1419                 verbose.report("Using fontManager instance from %s" % _fmcache)
   1420         except:
-> 1421             _rebuild()
   1422     else:
   1423         _rebuild()

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in _rebuild()
   1404     def _rebuild():
   1405         global fontManager
-> 1406         fontManager = FontManager()
   1407         if _fmcache:
   1408             pickle_dump(fontManager, _fmcache)

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in __init__(self, size, weight)
   1042         #  Load TrueType fonts and create font dictionary.
   1043 
-> 1044         self.ttffiles = findSystemFonts(paths) + findSystemFonts()
   1045         self.defaultFamily = {
   1046             'ttf': 'Bitstream Vera Sans',

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in findSystemFonts(fontpaths, fontext)
    311             fontpaths = [fontdir]
    312             # now get all installed fonts directly...
--> 313             for f in win32InstalledFonts(fontdir):
    314                 base, ext = os.path.splitext(f)
    315                 if len(ext)>1 and ext[1:].lower() in fontexts:

C:\Users\Owner\Anaconda2\envs\gl-env\lib\site-packages\matplotlib\font_manager.py in win32InstalledFonts(directory, fontext)
    228                         continue
    229                     if not os.path.dirname(direc):
--> 230                         direc = os.path.join(directory, direc)
    231                     direc = os.path.abspath(direc).lower()
    232                     if os.path.splitext(direc)[1][1:] in fontext:

C:\Users\Owner\Anaconda2\envs\gl-env\lib\ntpath.pyc in join(path, *paths)
     83         if result_path and result_path[-1] not in '\\/':
     84             result_path = result_path + '\\'
---> 85         result_path = result_path + p_path
     86     ## add separator between UNC and non-absolute path
     87     if (result_path and result_path[0] not in '\\/' and

UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 7: ordinal not in range(128)

0 个答案:

没有答案