问题描述
我已经安装了软件包bigfloat以及MPFR和GMP库.当我在终端中运行python(使用Mac)时,bigfloat可以导入并成功运行.但是,我通常在iPython Notebook中编写脚本.当我尝试在此处导入bigfloat时,提示找不到模块".
我已经安装了其他软件包,例如SciPy,并使用了print scipy.文件我看到它位于//anaconda/lib/python2.7/site-packages/scipy/ init .pyc
我不确定如何检查bigfloat的位置.通过阅读其他人的安装问题,我认为我的计算机上可能存在多个版本的Python,这是问题吗?如果是这种情况,我不知道如何1).找到其他" Python并将其删除,然后2).确保以后的安装始终安装在正确的位置(因为我不知道它在哪里).
我已包含sys.path和错误:
import sys
sys.path
['',
'//anaconda/python.app/Contents/lib/python27.zip',
'//anaconda/python.app/Contents/lib/python2.7',
'//anaconda/python.app/Contents/lib/python2.7/plat-darwin',
'//anaconda/python.app/Contents/lib/python2.7/plat-mac',
'//anaconda/python.app/Contents/lib/python2.7/plat-mac/lib-scriptpackages',
'//anaconda/python.app/Contents/lib/python2.7/lib-tk',
'//anaconda/python.app/Contents/lib/python2.7/lib-old',
'//anaconda/python.app/Contents/lib/python2.7/lib-dynload',
'//anaconda/lib/python2.7/site-packages',
'//anaconda/lib/python2.7/site-packages/PIL',
'//anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
'//anaconda/lib/python2.7/site-packages/IPython/extensions']
import numpy as np
import scipy
from scipy.special import gamma, gammainc
import scipy.optimize as scopt
print scipy.__file__
import sympy
print sympy.__file__
import bigfloat
import sympy.mpmath as mpmath
from __future__ import division
ImportError跟踪(最近一次通话最后一次) 在 () 6导入sympy 7个打印符号.文件----> 8导入bigfloat 9将sympy.mpmath导入为mpmath 10来自未来进口部门
ImportError:没有名为bigfloat的模块
//anaconda/lib/python2.7/site-packages/scipy/ init .pyc//anaconda/lib/python2.7/site-packages/sympy/ init .pyc
我主要是通过使用问题/答案.基本上,我使用以下方法将"anaconda路径"和"python路径"都添加到sys.path中:
sys.path = [''等.]
I have installed the package bigfloat and the MPFR and GMP libraries. When I run python in the terminal (I use a Mac), bigfloat can be imported and works successfully. However, I typically write my scripts in iPython Notebook. When I try to import bigfloat here, it says 'module not found.'
I have installed other packages such as SciPy, and using print scipy.file I see that it is located at //anaconda/lib/python2.7/site-packages/scipy/init.pyc
I'm not sure of how to check where bigfloat is located. From reading other peoples' installation issues, I am thinking that there might be more than one version of Python on my computer, and that is the problem? If this is the case, I'm not sure how to 1). Find the 'other' Python and delete it and 2). Make sure that future installations always install in the correct place (because I don't know where this is).
I've included my sys.path and error:
import sys
sys.path
['',
'//anaconda/python.app/Contents/lib/python27.zip',
'//anaconda/python.app/Contents/lib/python2.7',
'//anaconda/python.app/Contents/lib/python2.7/plat-darwin',
'//anaconda/python.app/Contents/lib/python2.7/plat-mac',
'//anaconda/python.app/Contents/lib/python2.7/plat-mac/lib-scriptpackages',
'//anaconda/python.app/Contents/lib/python2.7/lib-tk',
'//anaconda/python.app/Contents/lib/python2.7/lib-old',
'//anaconda/python.app/Contents/lib/python2.7/lib-dynload',
'//anaconda/lib/python2.7/site-packages',
'//anaconda/lib/python2.7/site-packages/PIL',
'//anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
'//anaconda/lib/python2.7/site-packages/IPython/extensions']
import numpy as np
import scipy
from scipy.special import gamma, gammainc
import scipy.optimize as scopt
print scipy.__file__
import sympy
print sympy.__file__
import bigfloat
import sympy.mpmath as mpmath
from __future__ import division
ImportError Traceback (most recent call last) in () 6 import sympy 7 print sympy.file----> 8 import bigfloat 9 import sympy.mpmath as mpmath 10 from future import division
ImportError: No module named bigfloat
//anaconda/lib/python2.7/site-packages/scipy/init.pyc//anaconda/lib/python2.7/site-packages/sympy/init.pyc
I figured it out, mainly from using this question/answer.
Basically, I added both my "anaconda paths" and my "python paths" to my sys.path, using:
sys.path =['', etc.].
这篇关于模块已成功安装,但在IPython中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!