title: Running OpenCV from a Python virtualenv
body: <p>I'm trying to install OpenCV within a virtualenv on my Ubuntu Server 12.04. I found <a href="https://stackoverflow.com/questions/9592389/is-it-possible-to-run-opencv-python-binding-from-a-virtualenv">a thread discussing this</a> but managed to extract no information from it.</p>
  
  <p>I tried using <code>pip install pyopencv</code> but it failed.</p>
  
  <pre><code>...
  package/extras/core/ndarray.cpp:598:1:   instantiated from here
  
  package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
  
  package/extras/core/ndarray.cpp: In function ‘boost::python::api::object sdcpp::from_ndarray_impl(const sdcpp::ndarray&amp;) [with T = cv::Scalar_&lt;double&gt;]’:
  
  package/extras/core/ndarray.cpp:601:1:   instantiated from here
  
  package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
  
  package/extras/core/ndarray.cpp: In function ‘boost::python::api::object sdcpp::from_ndarray_impl(const sdcpp::ndarray&amp;) [with T = cv::Range]’:
  
  package/extras/core/ndarray.cpp:604:1:   instantiated from here
  
  package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
  
  error: command 'gcc' failed with exit status 1
  </code></pre>
  
  <p>This error only occurs the second time I run <code>pip install</code>. If I delete the remainging <code>build/</code> folder I get this error.</p>
  
  <pre><code>-- Configuring incomplete, errors occurred!
  
  Configuring PyOpenCV via CMake...
  
  Error: error occurred while running CMake to configure PyOpenCV.
  
  You may want to manually configure PyOpenCV by running cmake's tools:
  
      mkdir build
  
      cd build
  
      cmake-gui ..    OR    cmake ..
  
      cd ..
  
  ----------------------------------------
  Command python setup.py egg_info failed with error code 255
  </code></pre>
  
  <p>I have at least the following apt packages installed.</p>
  
  <pre><code>build-essential
  uuid-dev
  python-dev
  python-pip
  libpq-dev
  cmake
  libboost-dev
  libcv-dev
  libcvaux-dev
  libboost-python-dev
  libboost1.48-dev
  </code></pre>
  
  <p>How can I install OpenCV within my virtualenv?</p>