私はPython公式サイトからDLしたpythonを使用しておりまして、
ipython notebook --pylab inline
で、問題なく図がインライン表示されておりました。
この度、
OpenCVを使う必要にかられたので、
Macport経由でpython-2.7やその他パッケージを入れました。
意気揚々と
ipython-2.7 notebook --pylab inline
と打って、
plt.plot([1,2,3,4])
と入力した所。下記のような警告が発生し、図が表示されませんでした。
In [1]:
plt.plot([1,2,3,4])
Out[1]:
[<matplotlib.lines.Line2D at 0x10ec46490>]
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: 'ascii' codec can't decode byte 0xe3 in position 15: ordinal not in range(128)
FormatterWarning,
<matplotlib.figure.Figure at 0x10e790610>
警告メッセージをぐぐった所、どうやら私の起きている問題とは別の問題で発生しているようです。
http://stackoverflow.com/questions/22898245/libpng-version-incompatibility-in-fresh-installation-of-ipython
ターミナル上でipythonからplotしても
libpng warningは出ません。
そして、新しい窓でプロットの結果が表示されます。
試してみた所、ipython-2.7 notebook --pylab inlineで
import sys
reload(sys)
sys.setdefaultencoding('utf8')
と入力した所、問題なくインライン表示で図がプロットされます。
しかし、その後
print
した内容がnotebook上に表示されません。
どうかお力添えをお願い致します。
あなたの回答
tips
プレビュー