首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从sage-python导入sage.finance。

无法从sage-python导入sage.finance。
EN

Stack Overflow用户
提问于 2014-06-10 05:28:34
回答 1查看 185关注 0票数 1

在运行sage时,我可以毫无问题地导入sage.finance。但是,在运行sage -python (或sage -ipython)时,导入sage.finance会带来以下跟踪:

代码语言:javascript
复制
>>> 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内部导入财务模块?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-10 15:30:17

我不认为您可以直接导入东西,但只能从sage.all导入,而不是在shell中。鼠尾草进口了很多东西。尝尝这个。

代码语言:javascript
复制
$ 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_simulation
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24133496

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档