Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "C:\Anaconda3\lib\site-packages\matplotlib\colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "C:\Anaconda3\lib\site-packages\matplotlib\collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 62, in <module>
import matplotlib.textpath as textpath
File "C:\Anaconda3\lib\site-packages\matplotlib\textpath.py", line 15, in <module>
import matplotlib.font_manager as font_manager
File "C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1420, in <module>
_rebuild()
File "C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1405, in _rebuild
fontManager = FontManager()
File "C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1043, in __init__
self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 312, in findSystemFonts
for f in win32InstalledFonts(fontdir):
File "C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 231, in win32InstalledFonts
direc = os.path.abspath(direc).lower()
File "C:\Anaconda3\lib\ntpath.py", line 535, in abspath
path = _getfullpathname(path)
ValueError: _getfullpathname: embedded null character

这个问题貌似是python不能正确读取字符串

解决办法是打开C:\Anaconda3\lib\site-packages\matplotlib\font_manager.py文件,查找winreg.EnumValue,你会看到这样的代码

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()

将其替换成


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 = direc.split('\0', 1)[0]

这样就可以画图了

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

Matplotlib ValueError: _getfullpathname: embedded null character的更多相关文章

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

    Environment: Windows 10, Anaconda 3.6 matplotlib 2.0 import matplotlib.pyplot 报错: ValueError: _getfu ...

  2. 诡异错误一: ValueError: embedded null character

    使用如下语句读取名为0_xx.txt 文件时,遇到错误  ValueError: embedded null character if __name__ == '__main__': fr = ope ...

  3. python读取文件embedded null character是什么原因

    地址的\需要转义符: 将\写成\\ 或者在整个字符串前面添加字母r

  4. windows7,python3使用time.strftime()函数报ValueError: embedded null byte

    windows7环境下,执行代码报ValueError: embedded null byte时,在原代码前面加一行代码:locale.setlocale(locale.LC_ALL,'en')即可解 ...

  5. python与数值计算环境搭建

    数值计算的编程的软件很多种,也见过一些编程绘图软件的对比. 利用Python进行数值计算,需要用到numpy(矩阵) ,scipy(公式符号), matplotlib(绘图)这些工具包. 1.Linu ...

  6. [Python学习]错误篇二:切换当前工作目录时出错——FileNotFoundError: [WinError 3] 系统找不到指定的路径

    REFERENCE:<Head First Python> ID:我的第二篇[Python学习] BIRTHDAY:2019.7.13 EXPERIENCE_SHARING:解决切换当前工 ...

  7. 《征服 C 指针》摘录1:什么是空指针?区分 NULL、0 和 '\0'

    一.什么是空指针? 空指针 是一个特殊的指针值. 空指针 是指可以确保没有向任何一个对象的指针.通常使用宏定义 NULL 来表示空指针常量值. 空指针 确保它和任何非空指针进行比较都不会相等,因此经常 ...

  8. C/C++ 字符串 null terminal

    在C/C++中,字符串以'\0'结尾是一种强制要求,或者说,只有满足这个要求的 字符数组才能被称为字符串.否则,你所做的所有操作结果都是未定义的! C标准库string.h中所有关于字符串的函数都有一 ...

  9. 【linux】/dev/null作用和/dev/random

    一.  /dev/null /dev/null属于字符特殊文件,它属于空设备,是一个特殊的设备文件,它会丢弃一切写入其中的数据,写入它的内容都会永远丢失,而且没有任何可以读取的内容. 我们用file命 ...

随机推荐

  1. HDU 1709 The Balance( DP )

    The Balance Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  2. MVC通过重写OnActionExecuting获取控制器,方法和域

    一,如下代码 protected override void OnActionExecuting(ActionExecutingContext filterContext) {string _cont ...

  3. db2缓冲池

    CREATE BUFFERPOOL DEMOBP IMMEDIATE  SIZE 250 AUTOMATIC PAGESIZE 4 K ; CREATE BUFFERPOOL DEMOBP IMMED ...

  4. windows server 进入组策略管理

    方法: win+R 然后输入   gpmc.msc 即可在域服务器上进行组策略管理了.

  5. Java缓冲流的优点和原理

    不带缓冲的流的工作原理: 它读取到一个字节/字符,就向用户指定的路径写出去,读一个写一个,所以就慢了. 带缓冲的流的工作原理: 读取到一个字节/字符,先不输出,等凑足了缓冲的最大容量后一次性写出去,从 ...

  6. Bootstrap 网页1

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  7. 【串线篇】SpringMvc之强大的annotation-driven标签

    只要请求不好使就召唤mvc:annotation-driven <mvc:default-servlet-handler/> <mvc:annotation-driven/> ...

  8. java 延时

    Java中主要有两种方法来实现延迟,即:Thread和Timer 1.普通延时用Thread.sleep(int)方法,这很简单.它将当前线程挂起指定的毫秒数.如try{Thread.currentT ...

  9. [REPRINT] Java 101: Classes and objects in Java

    http://www.javaworld.com/article/2979739/learn-java/java-101-classes-and-objects-in-java.html?page=3 ...

  10. Java多线程状态切换

    原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11426573.html 线程状态 NEW RUNNABLE BLOCKED WAITING TIMED ...