matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path相关的知识,希望对你有一定的参考价值。

Environment:

Windows 10,

Anaconda 3.6

matplotlib 2.0

 

import matplotlib.pyplot

报错:

ValueError: _getfullpathname: embedded null character in path

 

原因以及Solution:

http://stackoverflow.com/questions/34004063/error-on-import-matplotlib-pyplot-on-anaconda3-for-windows-10-home-64-bit-pc

 

修改的文件:

Anaconda3/lib/site-packages/matplotlib/font_manager.py

修改的函数:

 def win32InstalledFonts(directory=None, fontext=‘ttf‘):

        try:
            for j in range(winreg.QueryInfoKey(local)[1]):
                try:
                    key, direc, any = winreg.EnumValue( local, j)
                    if not is_string_like(direc):
                        continue
                    if not os.path.dirname(direc):
                        direc = os.path.join(directory, direc)
                    # direc = os.path.abspath(direc).lower()
                    direc = direc.split(\0, 1)[0]
                    if os.path.splitext(direc)[1][1:] in fontext:
                        items[direc] = 1

 

以上是关于matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path的主要内容,如果未能解决你的问题,请参考以下文章

Python库 - import matplotlib.pyplot as plt 报错问题

import matplotlib.pyplot 给出 ImportError: dlopen(...) Library not loaded libpng15.15.dylib

Mac OS Pycharm 上的 Python 通过“import matplotlib.pyplot as plt”给出框架错误

Python中用matplotlib.pyplot画图总结

numpy pandas matplotlib

python数据可视化之matplotlib.pyplot绘图时图片显示不全的解决方法(图文并茂版!!!)