[Numpy-discussion] cannot import name ccompiler

Robert Kern robert.kern@gmail....
Tue Apr 10 13:52:20 CDT 2007


Jason Braswell wrote:
> Hi, folks.  I'm a newbie trying to get started with SciPy on Windows.  I
> installed it without problem, but when I try to import the SciPy module
> or run the 'numpy' test, I get the following output:
> ***********************************************
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "C:\Python24\Lib\site-packages\numpy\__init__.py", line 89, in test
>     return NumpyTest().test(level, verbosity)
>   File "C:\Python24\Lib\site-packages\numpy\testing\numpytest.py", line
> 288, in
> __init__
>     from numpy.distutils.misc_util import get_frame
>   File "C:\Python24\Lib\site-packages\numpy\distutils\__init__.py", line
> 5, in ?
> 
>     import ccompiler
>   File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py",
> line 6, in
> ?
>     from distutils.ccompiler import *
>   File "C:\Python24\Lib\site-packages\numpy\distutils\__init__.py", line
> 5, in ?
> 
>     import ccompiler
>   File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py",
> line 7, in
> ?
>     from distutils import ccompiler #as ccompiler
> ImportError: cannot import name ccompiler
> *****************************************************************
> I tried to fix it by adding damn near everything to my path, which now
> looks like this: 

That's the problem. You have the numpy package directory in your sys.path, so
when it tries to import the standard library's distutils package, it finds
numpy/distutils instead. You want site-packages/ on your sys.path, not
site-packages/numpy/.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list