I've successfully installed Python 2.7 and Anaconda but when i try to import a library i get always this error:
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
I've set up the PYTHONHOME
to C:\Python27
and PYTHONPATH
to C:\Python27\Lib
.
EDIT : content of PATH
In my $PATH variable i have C:\Users\Mattia\Anaconda2
, C:\Users\Mattia\Anaconda2\Scripts
and C:\Users\Mattia\Anaconda2\Library\bin
.
Do i have to set any other env veriables?
The problem is that you should not have either PYTHONPATH
or PYTHONHOME
set. They are both pointing to a non-Continuum version of Anaconda, I believe. Anaconda will install (by default) into a directory called Anaconda
, either at C:\Anaconda
or at C:\Users\USERNAME\Anaconda
(IIRC). It is generally recommended that you should not ever set PYTHONPATH
or PYTHONHOME
, except as a last resort, exactly because of these kinds of problems.
You can see which Python interpreter you're running by doing:
>>> import sys
>>> sys.executable
And then you can see what directories are ending up in your Python library path (where import
statements will look for packages, such as scipy
and numpy
) by doing one of the following:
>>> import sys
>>> sys.path
or the more readable version:
>>> import sys
>>> for p in sys.path:
... print p
As pointed out by @Mr.F the error was given by the presence of the PYTHONPATH
and PYTHONHOME
. Deleting them i was able to use the Anaconda version of python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With