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.].