In most cases this location will point to your system install of Python. Open up P圜harm and create a new “Pure Python” project: Figure 1: Creating a new Pure Python project in P圜harm.įrom here we need to set the location of our Python Interpreter. In short, it was one of the best choices I’ve ever made in terms of development environments.Īnyway, now that our virtual environment is all setup let’s connect it to a P圜harm project. Boy, that was a huge mistake.Ībout six months ago I decided to give P圜harm a real chance and not let my previous experiences bias my opinion. You see, back in college I was forced to use Eclipse for Java development - and since I was never fond of Java or Eclipse, I (ignorantly) turned my back on any IDE that reminded me of it. It’s hard to believe, but for years I turned the other way at P圜harm and dismissed it. They have both a free community edition and a paid version with a bunch of nice bells and whistles. If you are not already using the P圜harm IDE for editing your code, it’s definitely worth a look. $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so $ ln -s /usr/local/lib/python2.7/site-packages/cv.py cv.py Now that we have the path to our OpenCV install, we can sym-link it into our virtual environment: $ cd ~/.virtualenvs/pyimagesearch/lib/python2.7/site-packages/ This may not be the case for your system, so be sure to find your OpenCV install path and make note of it - you’ll need this path for the following step. On my system, OpenCV is installed in /usr/local/lib/python2.7/site-packages/ You’ll need to manually sym-link your cv2.so and cv.py files into the site-packages directory of the pyimagesearch virtual environment. Step 2: Sym-link your cv2.so and cv.py filesĪs I’m sure you already know, OpenCV is not pip-installable. Now that our virtual environment has been setup, let’s install NumPy, Scipy, matplotlib, scikit-learn, and scikit-image which are all commonly used for computer vision development: $ pip install numpy For this example, let’s name the virtual environment pyimagesearch : $ mkvirtualenv pyimagesearch Open up a terminal and create your virtual environment. The first thing we are going to do is setup our virtual environment. I’ll also be setting up my system with Python 2.7 and OpenCV 2.4.X however, you can use the same instructions to setup your environment with Python 3 and OpenCV as well, you’ll just need to change the paths to the Python and OpenCV files. These installation instructions and associated screenshots were gathered on my OSX machine, but these instructions will work on both Linux and Windows (for Windows you’ll have to change the various paths to files of course, but that’s okay). I’m also going to assume that you have virtualenv and virtualenvwrapper installed as well. The rest of this blog post will assume that you have already installed OpenCV and the appropriate Python bindings on your system. There is a certain calming serenity that comes with watching a thunderstorm roll in - and hopefully the rest of this guide gives you some calming serenity yourself when you go to setup P圜harm to play nice with OpenCV and virtual environments. And over the past two years the development environments between the two have become horribly out of sync and almost unusable.Īs I sat down Sunday night, looking out at the anvil-shaped thunderclouds rolling in across the Long Island sound, I took a second and sipped some tea (spiked with some peppermint schnapps it is the weekend, of course) from my mug and watched as the lighting danced haphazardly across the sky. While I use my 13in MacBook Pro while I travel, I have a second MacBook Pro that I use on a daily basis as my main development system. And to be honest, I was considering rebuilding the development environment on my travel system for awhile now. No worries though, I use Carbon Copy Cloner and Backblaze, so no data was lost. Apparently, the 13in MacBook Pro that I use when I’m traveling decided to shit the bed. Reconfiguring and reinstalling OSX on your MacBook Pro. You know what makes for a (not so) fun weekend? Click here to download the source code to this post
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |