2015-11-08 82 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的目的。