win10 python3下打印报错

在学习《自然语言处理入门》第25页时,输入代码hanlp segment < input.txt > output.txt -a crf --no-tag后,遇到报错UnicodeEncodeError: ‘utf-8’ codec can’t encode character ‘\udc80’ in position 5: surrogates not allowed。经过尝试后发现可能和HanLP.newSegment()函数有关,于是做了以下测试: 直接print any2utf8(line)不会报错,会把“上山打老虎”这句话打印五遍,但是使用HanLp.newSegment()函数后会报错 。系统是win10,python版本3.6.2,请问这个问题如何解决呢?

用docker 弄个linux环境,可以一劳永逸的解决此类问题

一样的问题。多谢大佬