我想在Canopy Express上使用matplotlib。即使是简单的代码也无法运行...
注意:系统无法识别
从控制台我们可以看到:
注意:系统无法识别
plot(x)
函数。似乎与ASCII X Unicode有关。我的电脑使用Unicode英语(美国)。从控制台我们可以看到:
C:\Users\dafonseca\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\font_manager.py in createFontList(fontfiles, fontext)
582 continue
583 try:
--> 584 prop = ttfFontProperty(font)
585 except KeyError:
586 continue
C:\Users\dafonseca\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\font_manager.py in ttfFontProperty(font)
396 sfnt2 = ''
397 if sfnt4:
--> 398 sfnt4 = sfnt4.decode('ascii').lower()
399 else:
400 sfnt4 = ''
UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 0: ordinal not in range(128)'
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10)
line, = plt.plot(x, np.sin(x), '--', linewidth=2)
dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
line.set_dashes(dashes)
plt.show()