在运行sage时,我可以毫无问题地导入sage.finance。但是,在运行sage -python (或sage -ipython)时,导入sage.finance会带来以下跟踪:
>>> import sage.finance
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/finance/__init__.py", line 3, in <module>
import all
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/finance/all.py", line 1, in <module>
from stock import Stock
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/finance/stock.py", line 20, in <module>
from sage.structure.all import Sequence
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/structure/all.py", line 1, in <module>
from factorization import Factorization
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/structure/factorization.py", line 187, in <module>
from sage.rings.integer import Integer
File "integer.pyx", line 1, in init sage.rings.integer (sage/rings/integer.c:38248)
File "morphism.pyx", line 1, in init sage.categories.morphism (sage/categories/morphism.c:7490)
File "map.pyx", line 1, in init sage.categories.map (sage/categories/map.c:8604)
File "parent.pxd", line 12, in init sage.structure.element (sage/structure/element.c:31286)
File "map.pxd", line 4, in init sage.structure.parent (sage/structure/parent.c:24406)
AttributeError: 'module' object has no attribute 'Map'是否知道什么会导致此错误,以及如何从sage -python内部导入财务模块?
发布于 2014-06-10 15:30:17
我不认为您可以直接导入东西,但只能从sage.all导入,而不是在shell中。鼠尾草进口了很多东西。尝尝这个。
$ sage -ipython
Python 2.7.5 (default, Oct 7 2013, 07:44:02)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from sage.all import finance
In [2]: finance.[tab]
finance.MarkovSwitchingMultifractal
finance.Stock
finance.TimeSeries
finance.autoregressive_fit
finance.black_scholes
finance.fractional_brownian_motion_simulation
finance.fractional_gaussian_noise_simulation
finance.lazy_import
finance.multifractal_cascade_random_walk_simulation
finance.stationary_gaussian_simulationhttps://stackoverflow.com/questions/24133496
复制相似问题