Install numpy and scipy on windows
Install numpy using easy_install can pop out some error such as “.Net framework” error.
But this is what you can do:
cd C:\Python27\scripts
python .\easy_install-27-script.py pip
python .\pip-2.7-script.py install uncertainties
python .\pip-2.7-script.py help
python .\pip-2.7-script.py install nose
import numpy
numpy.test('1','10')
import scipy
scipy.test('1','10')
But maybe the last scipy is still available because of “Blas” directory issue. And you can’t install it through pip neither.
This is because scipy use Blas, which is a fortan library.
So you have two options:
- Use unofficial installer version:
http://sourceforge.net/projects/scipy/files/scipy/0.12.0/
- So you have to install MinGW. Go to http://sourceforge.net/projects/mingw/files/MinGW/
install the newest version of MinGW, during the installation, remember to select the “fortan” compiler.
However, if you want to use scipy.misc.imread, you have to install PIL, since Note that the Python Imaging Library (PIL) is not a dependency of SciPy and therefore the pilutil module is not available on systems that don’t have PIL installed.
I tried install PIL, then I got an error about unable to find vcvarsall.bat,
This is because Python2.7 use VS9.0 to compile but unable to find it. This is what needs to do:
C:\Python27\Lib\distutils\msvc9compiler.py
Find line 243, change is to:
toolskey = "VS100COMNTOOLS"
Then
you just need to add it via the “Advanced System Settings” link in Control Panel\System and Security\System.
Or use command line:
set VS100COMNTOOLS="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\"
However, if you are using import scipy and scipy.misc, you will get an error that no attribute misc, this is because
The modules inside scipy aren’t accessible as attributes of the base scipy package. You need to do import scipy.misc or from scipy import misc
I have posted a very simple method to install OpenCV 2.4 for Python in Windows here : Install OpenCV in Windows for Python
It is just as simple as copy and paste. Hope it will be useful for future viewers.
- Download Python, Numpy, OpenCV from their official sites.
- Extract OpenCV (will be extracted to a folder opencv)
- Copy ..\opencv\build\python\x86\2.7\cv2.pyd
- Paste it in C:\Python27\Lib\site-packages
-
Open Python IDLE or terminal, and type
import cv2
If no errors shown, it is OK.