I tried to install numpy, but whenever I start my program, I get these messages.
Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
Traceback (most recent call last):
File "C:\Python34\numpy\__init__.py", line 155, in <module>
from numpy.__config__ import show as show_config
ImportError: No module named 'numpy.__config__'
I don't understand what it means by not importing numpy from it's source directory. Where am I supposed to import it from instead?
The error means just what it says. You are probably in
C:\Python34
orC:\Python34\numpy
when you runpython
on the command line. Switch to another directory (such asC:\
) and runpython
, then tryimport numpy
and see what happens.From your comments, it looks like you didn't properly install
numpy
, just unzipped it into yourC:\Python34
directory. The easiest way to install this modules is to visit Christoph Gohlke's Python Extension Packages for Windows Repository and go down tonumpy
. Download thecp34
file for your version of Python (either 32- or 64-bit). Then, on the command line, switch to your Downloads directory and run, for example(if you downloaded the 64-bit version) and it should install quite nicely. If you get a
Command not found
error forpip
, make sure you addC:\Python34\Scripts
to your PATH environment variable. Once you do that, restart the command line and it should work perfectly.Gohlke has a ton of pre-compiled modules for Python, mostly relating to scientific computing, and I always check there first before installing from PyPI with
pip
.