Install Opencv For Python 2.7 On Mac

admin
Install Opencv For Python 2.7 On Mac 6,9/10 370 votes

By chance I just got this set up and working last week. Essentially it's three steps: Step 1. Install OpenCV using Homebrew.

It has C++, Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and Android. OpenCV was designed for computational efficiency and with a strong focus on real-time applications. Written in optimized C/C++, the library can take advantage of multi-core processing. Installing OpenCV with python on a Mac. The Homebrew version of OpenCV is compiled to support Pythons 2.7 and 3.6 so you may as well install one of those, although other versions may work too. The key is you need to find the location of the site-packages directory for your python: Within the terminal start python, and at the interactive.

The homebrew distribution used to be a bit finicky to get Python support, but as of a few months ago they simplified it down to a single precompiled distribution. Fortunately this includes Python 2/Python 3 support, ffmpeg support, and everything else you're likely to need.

I do not advocate compiling OpenCV from source, it's a pain to get it configured and working. Also the version that Anaconda installs (conda install -c menpo opencv) had serious performance issues on my machine.

The Homebrew version works well. Install python on your computer by any method you want: Anaconda, Homebrew, etc. The Homebrew version of OpenCV is compiled to support Pythons 2.7 and 3.6 so you may as well install one of those, although other versions may work too. The key is you need to find the location of the site-packages directory for your python: Within the terminal start python, and at the interactive prompt do 'import sys' followed by 'print(sys.path)'. (Without the quotes; I'll assume you have some knowledge of Python.) In the sys.path look for a directory path that contains 'site-packages'.

Copy it down somewhere. In the site-packages directory you found above, you'll need to put a symlink to the OpenCV library installed by Homebrew. By default this library is installed by Homebrew at a location like /usr/local/opt/opencv/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so So in the terminal you'll cd to the site-packages directory, and then execute 'ln -s /usr/local/opt/opencv/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so cv2.so' This will create a symlink called 'cv2.so' in site-packages. Horse computer games for mac. (It needs to have this name.) Step 4. Re-launch the python interpreter, and type 'import cv2'.

If that works, type 'print(cv2.__version__)'.

Installing Python Modules Email: As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open source license terms. This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common (and sometimes even rare!) problems, as well as potentially contributing their own solutions to the common pool. This guide covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the. Key terms • pip is the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers. • A virtual environment is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide.

Uninstall python 2.7 mac

• venv is the standard tool for creating virtual environments, and has been part of Python since Python 3.3. Starting with Python 3.4, it defaults to installing pip into all created virtual environments. • virtualenv is a third party alternative (and predecessor) to venv.

It allows virtual environments to be used on versions of Python prior to 3.4, which either don’t provide venv at all, or aren’t able to automatically install pip into created environments. • The is a public repository of open source licensed packages made available for use by other Python users. • the is the group of developers and documentation authors responsible for the maintenance and evolution of the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on both. • distutils is the original build and distribution system first added to the Python standard library in 1998. While direct use of distutils is being phased out, it still laid the foundation for the current packaging and distribution infrastructure, and it not only remains part of the standard library, but its name lives on in other ways (such as the name of the mailing list used to coordinate Python packaging standards development). Note For POSIX users (including Mac OS X and Linux users), the examples in this guide assume the use of a.