0

我无法使用 Ipython 从 Mac 终端导入 scipy、sympy。我的 Python 发行版是 Canopy,这也是我的默认 Python 环境(IPython 别名为 /Library/Enthought/Canopy_64bit/User/bin/ipython。)

操作系统为 OS X 10.9。

两次尝试的错误是:

In [3]: import sympy
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-7fb0c7cf9177> in <module>()
----> 1 import sympy

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sympy/__init__.py in <module>()
     68 # This module is slow to import:
     69 #from physics import units
---> 70 from plotting import plot, Plot, textplot, plot_backends, plot_implicit
     71 from printing import pretty, pretty_print, pprint, pprint_use_unicode, \
     72     pprint_try_use_unicode, print_gtk, print_tree, pager_print, TableForm

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sympy/plotting/__init__.py in <module>()
----> 1 from plot import plot_backends
      2 from plot_implicit import plot_implicit
      3 from proxy_pyglet import Plot
      4 from textplot import textplot
      5 from pygletplot import PygletPlot

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sympy/plotting/plot.py in <module>()
     29 from sympy.core.compatibility import set_union
     30 import warnings
---> 31 from experimental_lambdify import (vectorized_lambdify, lambdify)
     32
     33 #TODO probably all of the imports after this line can be put inside function to

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sympy/plotting/experimental_lambdify.py in <module>()
     71
     72 from sympy.external import import_module
---> 73 np = import_module('numpy')
     74 import warnings
     75

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sympy/external/importtools.py in import_module(module, min_module_version, min_python_version, warn_not_installed, warn_old_version, module_version_attr, module_version_attr_call_args, __import__kwargs, catch)
    121
    122     try:
--> 123         mod = __import__(module, **__import__kwargs)
    124     except ImportError:
    125         if warn_not_installed:

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.py in <module>()
    141         return loader(*packages, **options)
    142
--> 143     import add_newdocs
    144     __all__ = ['add_newdocs']
    145

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
      7 #       core/fromnumeric.py, core/defmatrix.py up-to-date.
      8
----> 9 from numpy.lib import add_newdoc
     10
     11 ###############################################################################

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
     11
     12 import scimath as emath
---> 13 from polynomial import *
     14 #import convertcode
     15 from utils import *

/Users/nick/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/polynomial.py in <module>()
      9 import re
     10 import warnings
---> 11 import numpy.core.numeric as NX
     12
     13 from numpy.core import isscalar, abs, finfo, atleast_1d, hstack, dot

AttributeError: 'module' object has no attribute 'core'
4

1 回答 1

0

我建议你删除:

~/Library/Enthought/Canopy_64bit/User/

并重新启动 Canopy。标准包将被重新安装。您将需要重新安装/更新您之前添加或更新的任何软件包。

不要将 mac 端口与 Canopy 一起使用。它们不兼容。

于 2013-11-04T16:55:40.140 回答