无法在Jupyter笔记本中导入numpy

无法在Jupyter笔记本中导入numpy,numpy,import,ipython,importerror,jupyter,Numpy,Import,Ipython,Importerror,Jupyter,我是伊皮顿/朱皮特的新手。Python技能有限,但需要学习。我正在尝试将numpy作为np导入,并获得以下结果: --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-4ee716103900> in &

我是伊皮顿/朱皮特的新手。Python技能有限,但需要学习。我正在尝试将numpy作为np导入,并获得以下结果:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-4ee716103900> in <module>()
----> 1 import numpy as np

/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/__init__.py in <module>()
    166         return loader(*packages, **options)
    167 
--> 168     from . import add_newdocs
    169     __all__ = ['add_newdocs', 'ModuleDeprecationWarning']
    170 

/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
     11 from __future__ import division, absolute_import, print_function
     12 
---> 13 from numpy.lib import add_newdoc
     14 
     15 ###############################################################################

/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
      6 from numpy.version import version as __version__
      7 
----> 8 from .type_check import *
      9 from .index_tricks import *
     10 from .function_base import *

/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/lib/type_check.py in <module>()
      9            'common_type']
     10 
---> 11 import numpy.core.numeric as _nx
     12 from numpy.core.numeric import asarray, asanyarray, array, isnan, \
     13                 obj2sctype, zeros

/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/core/__init__.py in <module>()
      4 from numpy.version import version as __version__
      5 
----> 6 from . import multiarray
      7 from . import umath
      8 from . import _internal # for freeze programs

ImportError: dlopen(/Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found.  Did find:
    /Users/jmmiii/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/numpy/core/multiarray.so: mach-o, but wrong architecture
我在我的Mac上安装了几个python,它有约塞米蒂,包括Canopy和Anaconda。我希望我的Jupyter笔记本使用Anaconda安装,包括与之相关的所有模块、库等。然而,jupyter似乎将目标对准了树冠。因此,我认为我的问题可能源于错误的联系

问题1:我的结论成立吗?如果没有,我会错过什么

问题2:我如何将jupyter与Anaconda而不是Canopy直接/链接,以便只导入Anaconda的所有内容


谢谢大家的帮助

您可以通过运行以下命令将路径设置为从~/anaconda/bin目录执行python命令,方法是在.bah_概要文件前加上该路径

export PATH="/Users/jmmiii/anaconda/bin:$PATH"
或者,您可以通过编辑~/.bash_配置文件并添加以下内容来为该命令创建别名:

alias jupyter-notebook="/Users/jmmiii/anaconda/bin/jupyter-notebook"

谢谢你,约翰!我会把它藏起来以备将来参考。沮丧的是,我实际上完全卸载了Anaconda并重新安装了它。现在,当我加载iPython笔记本,而不是Jupyter笔记本时,它可以工作。然而,这并不麻烦。我非常感谢上面的提示,特别是关于别名分配的提示。