0
我想使用ipython的八度功能。 因此,我通過pip命令安裝了oct2py模塊。 (準確地說,我使用ipython3和pip3命令)當使用octavemagic時,ipython發生了Oct2PyError
安裝本身已成功完成。 根據this web page,我在ipython終端模式下嘗試了以下命令。
In [1]: %load_ext octavemagic
- >%octave變得明顯可用。
In [2]: x = %octave [1 2; 3 4];x
- > ipython表示以下錯誤信息。
如何在沒有Oct2PyError的情況下使用octavemagic? 任何幫助,將不勝感激。提前致謝。
------------------------------------------------------------------ ---------
AttributeError Traceback (most recent call last)
<ipython-input-3-d604e29afc22> in <module>()
----> 1 x = get_ipython().magic('octave [1 2; 3 4];')
/usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
/usr/local/lib/python3.4/dist-packages/IPython/extensions/octavemagic.py in octave(self, line, cell, local_ns)
/usr/local/lib/python3.4/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/usr/local/lib/python3.4/dist-packages/IPython/extensions/octavemagic.py in octave(self, line, cell, local_ns)
326 text_output = self._oct.run(code, verbose=False)
327 except (oct2py.Oct2PyError) as exception:
--> 328 msg = exception.message
329 msg = msg.split('# ___<end_pre_call>___ #')[1]
330 msg = msg.split('# ___<start_post_call>___ #')[0]
AttributeError: 'Oct2PyError' object has no attribute 'message'
環境和軟件版本
操作系統:Ubuntu的14.04LTS(64位)
蟒蛇:3.4.0
IPython中:2.3.0
oct2py:2.4.0
numpy的:1.9.0
八度:3.8.1