2015-11-08 64 views
2

渲染我最近做了一个干净的安装OSX 10.11,装蟒蛇与Python 3.5,Xcode中,MacTEX都2015年和更新了所有的这些。错误的MacOS 10.11

我有一个问题,当我想在matplotlib使用乳胶。

下面是一个简单的例子:

import numpy as np 
import matplotlib.pyplot as plt 

from matplotlib import rc 

rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) 
rc('text', usetex=True) 

b = np.array([10, 11, 12, 13],dtype=np.float) 
bStd = np.array([1.4, 0.6, 0.3, 1.1],dtype=np.float) 

N = len(b) 
ind = np.arange(N,dtype=np.float) 
width = 0.8 

FS=11 

fig, ax = plt.subplots(figsize=(5.9055, 3.937)) 

Test = ax.plot(ind,b)  
yerr = plt.errorbar(ind,b,bStd) 

ax.set_title('Lorem ipsum dolor sit amet...', fontsize = FS, family = ['serif'])    
ax.set_xticks(ind)   
ax.set_xlim([-width, N-1+width]) 
ax.set_xticklabels(('A','B','C','D'), fontsize = FS, family = ['serif']) 
ax.set_ylabel('Value/$X/yy^2$',multialignment="center",fontsize = FS, family = ['serif']) 
ax.set_ylim(0,20) 

plt.tight_layout() 
plt.savefig('Test.pdf', format='pdf',bbox_inches='tight') 

当我尝试在matplotlib使用TeX的,我收到以下内容:

RuntimeError: LaTeX was not able to process the following string: 
b'lp' 
Here is the full report generated by LaTeX: 

我认为Spyder的不知道如何访问胶乳。这可能是El Capitan新的无根特性的问题吗?

我已经在网上搜索,当然#1,但没有一个建议,我发现那里,帮我。

你有什么想法?

我刚开始学习如何使用Python工作,所以我真的很缺乏经验,这可能会在我的例子中是可见的。

谢谢你的时间。

回答

0

使用Spyder与MacPorts一起安装时,我遇到了同样的问题,但在Mac OS终端上使用MacPorts安装的Python3,一切都很好(这很奇怪,因为Spyder依赖于这个版本的Python ...) 。

作为一种解决方法,如果使用终端适合您,您可以直接从终端运行您的脚本(但是,请确保您通过给予可执行文件的显式路径使用anaconda安装的python),但这违背了安装一个不错的GUI如Spyder的目的。