0

I have installed opencv 3.4.1 correctly on my system enviroment.

But after I create a conda virtual environment using a yml file inlcues opencv3.2.0, it leads some problems here:

Under the conda virtual env, I have to always first

cd PATH_TO_VIRTUAL_ENV/lib/python3.5/site_packages

such that import cv2 is correctly using the 3.2.0 version of opencv,without this step, 3.4.1 will be used.

Under the conda base environment , if the PATH in ~/.bashrc is added to anaconda3, then I will under conda base enviroment by default. import cv2 will use opencv 3.4.1 version.

Under the system enviroment, i.e first delete the PATH to anaconda3, then import cv2 will lead to segmentation fault.

It seems like the path variable has to be settled correctly, how could I solve this?

Update: upload my env.yml file

name: myenv
channels:
- menpo
- defaults
dependencies:
- cairo=1.14.8=0
- certifi=2016.2.28=py35_0
- cycler=0.10.0=py35_0
- dbus=1.10.20=0
- expat=2.1.0=0
- fontconfig=2.12.1=3
- freetype=2.5.5=2
- glib=2.50.2=1
- gst-plugins-base=1.8.0=0
- gstreamer=1.8.0=0
- harfbuzz=0.9.39=2
- hdf5=1.8.17=2
- icu=54.1=0
- jbig=2.1=0
- jpeg=9b=0
- libffi=3.2.1=1
- libgcc=5.2.0=0
- libgfortran=3.0.0=1
- libiconv=1.14=0
- libpng=1.6.30=1
- libtiff=4.0.6=3
- libxcb=1.12=1
- libxml2=2.9.4=0
- matplotlib=2.0.2=np111py35_0
- mkl=2017.0.3=0
- numpy=1.11.3=py35_0
- openssl=1.0.2l=0
- pandas=0.20.1=np111py35_0
- patsy=0.4.1=py35_0
- pcre=8.39=1
- pip=9.0.1=py35_1
- pixman=0.34.0=0
- pyparsing=2.2.0=py35_0
- pyqt=5.6.0=py35_2
- python=3.5.4=0
- python-dateutil=2.6.1=py35_0
- pytz=2017.2=py35_0
- qt=5.6.2=5
- readline=6.2=2
- scipy=0.19.0=np111py35_0
- seaborn=0.8=py35_0
- setuptools=36.4.0=py35_1
- sip=4.18=py35_0
- six=1.10.0=py35_0
- sqlite=3.13.0=0
- statsmodels=0.8.0=np111py35_0
- tk=8.5.18=0
- wheel=0.29.0=py35_0
- xz=5.2.3=0
- zlib=1.2.11=0
- opencv3=3.2.0=np111py35_0
- pip:
  - bleach==1.5.0
  - enum34==1.1.6
  - html5lib==0.9999999
  - markdown==2.6.11
  - protobuf==3.5.1
  - tensorflow==1.4.1
  - tensorflow-tensorboard==0.4.0
  - werkzeug==0.14.1
Community
  • 1
  • 1
waschbaerYOYO
  • 801
  • 1
  • 7
  • 8
  • How did you install opencv 3.4.1 on your system? What is the exact line in your yml file that installs opencv? Is it installed with pip? Is it opencv-python? – Eric C. Mar 09 '18 at 16:56
  • I installed opencv3.4.1 by cmake -DWITH_..... which is correctly installed, because I can import cv2 and test with version correctly. I installed opencv 3.2.0 on myenv with yml file means conda env create -n myenv -f env.yml – waschbaerYOYO Mar 09 '18 at 18:22
  • I just update my post, thank you for your help. – waschbaerYOYO Mar 09 '18 at 18:26
  • Using conda env create -n name -f file.yml helps a lot. this means no explicit command is required to install all dependencies, which helps a lot to build a complex virtual enviroment by just single line – waschbaerYOYO Mar 09 '18 at 18:28
  • did you read this post? https://stackoverflow.com/questions/38787748/installing-opencv-3-1-with-anaconda-python3 – Eric C. Mar 12 '18 at 10:44
  • I used yml file to install opencv3.2.0 in anaconda. That post does not help me. BTW, the cv2.so of 3.2.0 is already installed correctly, it is just the PATH problem, there is a chao – waschbaerYOYO Mar 12 '18 at 13:47

0 Answers0