Most linux distributions come pre-installed with python. To verify that this is the case, type the following into a terminal
And verify that you are running python 2.7.3
sudo apt-get install python-scipy python-numpy python-opencv idle-python2.7
If you are on a distribution that does not use apt, your package manager likely has equivalent packages.
Note Unfortunately, we weren’t able to figure out a way to install these tools on Mac systems without XCode, so you will need to download and run the XCode installer. This requires quite a large download (4GB), as well as giving your information to Apple to create a developer account. We are aware that this is very difficult for students with limited bandwidth and download caps, as well as generally inconvenient, but we were not able to work around it.
- Make sure your system is up to date applications > preferences > updates.
- Check if you already have XCode installed.
- Open a terminal window (application > utilities > terminal) and type
- This should print a long string with information about the installed gcc version, if instead you see “command not found”. You have to install Xcode and the command line tools
- Download and install XCode
- For OSX 10.6.8 Snow Leopard, get XCode 3.2.6 (requires apple developer account).
- For OSX 10.7+ (Lion and Mountain Lion), get the latest XCode 4 and command line tools. This can be done through the app store (requires that you enter credit card information), or through this link (requires only apple developer account). Command line tools can also be downloaded through
- XCode once it is installed. XCode > Preferences > Downloads > Command Line Tools.
- You can also install XCode via the App Store. The requirement for this is you need an AppleID for the App Store, which sometimes requires a Credit Card, even though the XCode download is free and you will not be charged.
Note For OSX 10.7+ (Lion and Mountain Lion), you need to allow third party applications to be installed. You can do this by going to application > system preferences > security and privacy. Click the lock in the bottom left corner and enter your password. Then, under ‘Allow applications downloaded from’, click ‘Anywhere’.
- Download and install the macports package appropriate for your system. Follow the install instructions carefully and let the install finish before proceeding.
- Open a new terminal window application > utilites > terminal and run
sudo port selfupdate
sudo port install python27 py27-numpy py27-scipy
sudo port install opencv +python27
sudo port select --set python python27
- Verify your install by running these commands in a new terminal window:
- This command will open the python shell, with the version of python and other statement, with a new line starting with >>>. In this shell type
(Note the double underscores) If you see no errors, you are all set!
Note It is recommended that you get a 32 bit python even if you have a 64 bit system. This is because official numpy and scipy packages are available only in 32 bit, which will disagree with a 64 bit python. If you do want to use 64 bit python, you are welcome to try the unofficial numpy, scipy and opencv packages found here
- Copy the file
cv2.pyd and paste it into
- Verify your install. Run Python(command line) from the start menu, and type in:
(note the double underscores) If this code executes without errors, you are all set!