Skip to content

Install

gr4viton edited this page Jun 25, 2018 · 5 revisions

python virtual environment = pve For python packages and pve` creation

  • i am using pipenv
  • you can create your pve any way you want - the required packages are in xxx/req/py/base.in

be in the folder with Pipfile

  • run pipenv install
    • to create pve with packages defined in Pipfile
  • run pipenv install -r req/py/base.in
    • to recreate pve
    • update Pipfile with packages defined one per line in requirements text file

Dependencies

OpenCV with python3 bindings

  • you can compile opencv (can take some time)

  • compilation creates cv2.so library which is to be used with the python

    • you have to link the library into your pve
      • step12
      • or something like this
ln -s /usr/local/lib/python3.5/dist-packages/cv2.so ~/path/to/pve/lib/python3.5/site-packages/cv2.so

in case of the pipenv it the venv dir is in ~/venvs/xxx-hash/ if you have ag - silversearcher install - you can use this snippet

echo "Getting pipenv venv folder"
pipenv_lib=$(pipenv --venv)"/lib/"
lib_path=$(ag -g 'cv2.so' -- /usr/local)
pipenv_python=$(ls $pipenv_lib | grep python)
echo "Check if the py3 version with which the opencv library was compiled = "$lib_path" - is the same as the one in venv = "$pipenv_python

echo "you have to use the same python version for the virtualenv and the cv2 compiling";

venv_lib_path=$pipenv_lib"/"$pipenv_python"/site-packages/cv2.so"

echo "creating symbolic link of $lib_path in $venv_lib_path"
ln -s $lib_path $venv_lib_path
 

will not work if the cv2.so is named like this

  • refer to the step9
  • look for cv2*.so in /usr/local/lib
Clone this wiki locally