遇到UnsatisfiableError时,如何在anaconda中创建环境:发现以下规格存在冲突:…?

时间:2019-03-30 01:51:57

标签: python-3.x numpy opencv computer-vision anaconda

我是一个尝试使用OpenCV的新手,我不得不使用.yml文件中的依赖项在anaconda中创建一个虚拟环境,但是numpy依赖项在设置环境时似乎会造成一些麻烦。

正在使用.yml文件创建环境,并在桌面(可写)中创建环境。

如何克服此错误?

我的.yml文件:

name: python-cvcourse
channels:
  - michael_wild
  - defaults
dependencies:
  - absl-py=0.4.1=py36_0
  - appdirs=1.4.3=py36h28b3542_0
  - asn1crypto=0.24.0=py36_0
  - astor=0.7.1=py36_0
  - attrs=18.2.0=py36h28b3542_0
  - automat=0.7.0=py36_0
  - backcall=0.1.0=py36_0
  - blas=1.0=mkl
  - bleach=2.1.4=py36_0
  - ca-certificates=2018.03.07=0
  - certifi=2018.10.15=py36_0
  - cffi=1.11.5=py36h74b6da3_1
  - colorama=0.3.9=py36h029ae33_0
  - constantly=15.1.0=py36h28b3542_0
  - cryptography=2.3.1=py36h74b6da3_0
  - cudatoolkit=9.0=1
  - cudnn=7.1.4=cuda9.0_0
  - cycler=0.10.0=py36h009560c_0
  - decorator=4.3.0=py36_0
  - entrypoints=0.2.3=py36_2
  - freetype=2.9.1=ha9979f8_1
  - gast=0.2.0=py36_0
  - grpcio=1.12.1=py36h1a1b453_0
  - h5py=2.8.0=py36hf7173ca_2
  - hdf5=1.8.20=hac2f561_1
  - html5lib=1.0.1=py36_0
  - hyperlink=18.0.0=py36_0
  - icc_rt=2017.0.4=h97af966_0
  - icu=58.2=ha66f8fd_1
  - idna=2.7=py36_0
  - incremental=17.5.0=py36_0
  - intel-openmp=2019.0=118
  - ipykernel=4.9.0=py36_0
  - ipython=6.5.0=py36_0
  - ipython_genutils=0.2.0=py36h3c5d0ee_0
  - ipywidgets=7.4.1=py36_0
  - jedi=0.12.1=py36_0
  - jinja2=2.10=py36_0
  - jpeg=9b=hb83a4c4_2
  - jsonschema=2.6.0=py36h7636477_0
  - jupyter=1.0.0=py36_6
  - jupyter_client=5.2.3=py36_0
  - jupyter_console=5.2.0=py36_1
  - jupyter_core=4.4.0=py36_0
  - jupyterlab=0.34.9=py36_0
  - jupyterlab_launcher=0.13.1=py36_0
  - keras=2.2.2=0
  - keras-applications=1.0.4=py36_1
  - keras-base=2.2.2=py36_0
  - keras-preprocessing=1.0.2=py36_1
  - kiwisolver=1.0.1=py36h6538335_0
  - libopencv=3.4.2=h20b85fd_0
  - libpng=1.6.34=h79bbb47_0
  - libprotobuf=3.6.0=h1a1b453_0
  - libsodium=1.0.16=h9d3ae62_0
  - libtiff=4.0.9=h36446d0_2
  - m2w64-gcc-libgfortran=5.3.0=6
  - m2w64-gcc-libs=5.3.0=7
  - m2w64-gcc-libs-core=5.3.0=7
  - m2w64-gmp=6.1.0=2
  - m2w64-libwinpthread-git=5.0.0.4634.697f757=2
  - markdown=2.6.11=py36_0
  - markupsafe=1.0=py36hfa6e2cd_1
  - matplotlib=2.2.3=py36hd159220_0
  - mistune=0.8.3=py36hfa6e2cd_1
  - mkl=2019.0=118
  - mkl_fft=1.0.4=py36h1e22a9b_1
  - mkl_random=1.0.1=py36h77b88f5_1
  - msys2-conda-epoch=20160418=1
  - nbconvert=5.3.1=py36_0
  - nbformat=4.4.0=py36h3a5bc1b_0
  - notebook=5.6.0=py36_0
  - numpy=1.15.1=py36ha559c80_0
  - numpy-base=1.15.1=py36h8128ebf_0
  - olefile=0.46=py36_0
  - opencv=3.4.2=py36h40b0b35_0
  - openssl=1.0.2p=hfa6e2cd_0
  - pandoc=2.2.3.2=0
  - pandocfilters=1.4.2=py36_1
  - parso=0.3.1=py36_0
  - pickleshare=0.7.4=py36h9de030f_0
  - pillow=5.2.0=py36h08bbbbd_0
  - pip=10.0.1=py36_0
  - prometheus_client=0.3.1=py36h28b3542_0
  - prompt_toolkit=1.0.15=py36h60b8f86_0
  - protobuf=3.6.0=py36he025d50_0
  - py-opencv=3.4.2=py36hc319ecb_0
  - pyasn1=0.4.4=py36h28b3542_0
  - pyasn1-modules=0.2.2=py36_0
  - pycparser=2.18=py36_1
  - pygments=2.2.0=py36hb010967_0
  - pyopenssl=18.0.0=py36_0
  - pyparsing=2.2.0=py36_1
  - pyqt=5.9.2=py36ha878b3d_0
  - python=3.6.6=hea74fb7_0
  - python-dateutil=2.7.3=py36_0
  - pytz=2018.5=py36_0
  - pywin32=223=py36hfa6e2cd_1
  - pywinpty=0.5.4=py36_0
  - pyyaml=3.13=py36hfa6e2cd_0
  - pyzmq=17.1.2=py36hfa6e2cd_0
  - qt=5.9.6=vc14h62aca36_0
  - qtconsole=4.4.1=py36_0
  - scikit-learn=0.19.1=py36hae9bb9f_0
  - scipy=1.1.0=py36h4f6bf74_1
  - send2trash=1.5.0=py36_0
  - service_identity=17.0.0=py36h28b3542_0
  - setuptools=40.2.0=py36_0
  - simplegeneric=0.8.1=py36_2
  - sip=4.19.8
  - six=1.11.0=py36_1
  - sqlite=3.24.0=h7602738_0
  - tensorflow=1.10.0
  - termcolor=1.1.0=py36_1
  - terminado=0.8.1=py36_1
  - testpath=0.3.1=py36h2698cfe_0
  - tk=8.6.8=hfa6e2cd_0
  - tornado=5.1=py36hfa6e2cd_0
  - traitlets=4.3.2=py36h096827d_0
  - twisted=18.7.0=py36hfa6e2cd_1
  - vc=14=h0510ff6_3
  - vs2015_runtime=14.0.25123=3
  - wcwidth=0.1.7=py36h3d5aa90_0
  - webencodings=0.5.1=py36_1
  - werkzeug=0.14.1=py36_0
  - wheel=0.31.1=py36_0
  - widgetsnbextension=3.4.1=py36_0
  - wincertstore=0.2=py36h7fe50ca_0
  - winpty=0.4.3=4
  - yaml=0.1.7=hc54c509_2
  - zeromq=4.2.5=he025d50_1
  - zlib=1.2.11=h8395fce_2
  - zope=1.0=py36_1
  - zope.interface=4.5.0=py36hfa6e2cd_0
  - opencv-contrib=3.3.1=py36_1
prefix: C:\Users\Marcial\Anaconda3\envs\cvcourse_windows

错误是:

(base) C:\Users\Jaysurya\Desktop>conda env create -f cvcourse_windows.yml 
 Collecting package metadata: done 
Solving environment: failed  
UnsatisfiableError: The following specifications were found to be in conflict: 
- numpy==1.15.1=py36ha559c80_0 
Use "conda search <package> --info" to see the dependencies for each package. 

anaconda promt screent shot attached

1 个答案:

答案 0 :(得分:0)

使用以下命令,您可以使用opencv创建环境:

conda create -n py3_opencv python=3.6
source activate py3_opencv
pip install opencv-python==3.4
conda install ... (if you need other dependencies)

(如果愿意,您可以使用conda install,但我个人更喜欢pip的opencv版本)

使用

pip install opencv-contrib-python==3.4

如果需要contrib版本。

希望这会有所帮助。