【问题标题】:sympy 0.7.1 plot does not worksympy 0.7.1 情节不起作用
【发布时间】:2015-04-10 03:23:01
【问题描述】:

我该如何解决这个问题,或者找到日志进行调查?

$ python
Python 2.7.3 (default, Dec 18 2014, 19:10:20) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import symbols
>>> from sympy.plotting import plot
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
>>> x = symbols('x')
>>> p1 = plot(x*x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> import sympy
>>> sympy.__version__
'0.7.1.rc1'

绘图模块似乎没有完全安装?

【问题讨论】:

    标签: python plot sympy


    【解决方案1】:

    this seems to be a very old version of sympy. the api has changed. in sympy 0.7.1.rc1, plot is a module, not a function.

    我通过删除mpmathsympy 的现有版本(已与apt 一起安装)并安装最新版本来解决此问题:

    $ sudo apt-get remove --purge python-mpmath python-sympy
    $ sudo python -m easy_install mpmath
    $ python
    Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mpmath
    >>> mpmath.__version__
    '0.19'
    $ sudo python -m easy_install sympy
    $ python
    Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sympy
    >>> sympy.__version__
    '0.7.6'
    

    现在plot() 显示图表。

    以后,使用python -m easy_install 安装最新版本,而不是apt-get 似乎有旧版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多