我將IPython設置爲在啓動時自動加載Sympy並配置它的輸出方法。然而,無論我嘗試我不能sympy初始化latex/unicode樣式輸出打印。採取配置Sympy啓動顯示輸出
步驟:
ipython3 create profile sympy
# this is where the profile was created
cd ~/.config/ipython/profile_sympy/startup
gedit 00-startup.py
# add some content (below)
sudo chmod a+x 00-startup.py
啓動腳本:
import sympy
sympy.init_printing(use_unicode=True)
當我啓動IPython的,它不顯示 「適合打印」 輸出:
ipython3
sympy.sqrt(8)
輸出:
2*sqrt(2)
使用qtconsole/notebook的類似輸出。
如果我再次運行init_printing命令,漂亮的打印顯示適用於該內核實例。此外,我知道啓動腳本正在正常運行,因爲我可以添加打印語句並獲取輸出(另外,軟件包已導入並可供使用)。
我在64位Ubuntu 13.10上安裝sympy 0.7.3,ipython3 1.1,matplotlib 1.3.1,numpy 1.7.1,scipy 0.12.0。
順便說一句,運行與PYTHONSTARTUP設置爲運行相同的啓動腳本的普通python3終端將適當漂亮的打印Sympy輸出。
爲什麼不使用預定義的sympy配置文件?隨着ipython2 1.1.0'ipython notebook --profile sympy'開箱即用的乳膠打印。 – Jakob