在IPython中无法导入sympy,scipy

时间:2021-08-25 00:49:02

I can't import scipy, sympy from the Mac terminal using Ipython. My python distribution is Canopy and this is also my default python environment (IPython is aliased to /Library/Enthought/Canopy_64bit/User/bin/ipython.)

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

The operationg system is OS X 10.9.

操作系统是OS X 10.9。

The error in both attempts is:

两次尝试中的错误是:

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'

1 个解决方案

#1


0  

I would suggest that you delete:

我建议你删除:

~/Library/Enthought/Canopy_64bit/User/

and restart Canopy. The standard packages will be re-installed. You will need to re-install/update any packages which you have previously added or updated.

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

Do not use mac ports with Canopy. They are not compatible.

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

#1


0  

I would suggest that you delete:

我建议你删除:

~/Library/Enthought/Canopy_64bit/User/

and restart Canopy. The standard packages will be re-installed. You will need to re-install/update any packages which you have previously added or updated.

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

Do not use mac ports with Canopy. They are not compatible.

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