anaconda的python环境配置

Posted ben-lbj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了anaconda的python环境配置相关的知识,希望对你有一定的参考价值。

关键字:anaconda opencv3 yum反悔

我在anaconda的python环境下尝试运行catch_usb_video.py脚本(来源:http://www.cnblogs.com/neo-T/p/6426029.html),结果报以下错误:

OpenCV(3.4.1) Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /opt/conda/conda-bld/opencv-suite_1527005194613/work/modules/highgui/src/window.cpp, line 618
Traceback (most recent call last):
  File "catch_viedo.py", line 30, in <module>
    CatchUsbVideo("截取视频流", int(sys.argv[1]))
  File "catch_viedo.py", line 6, in CatchUsbVideo
    cv2.namedWindow(window_name)
cv2.error: OpenCV(3.4.1) /opt/conda/conda-bld/opencv-suite_1527005194613/work/modules/highgui/src/window.cpp:618: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow

按照网上搜索到的结果:
1-安装libgnomeui-devel : yum install -y libgnomeui-devel
结果:这个其实只适用Ubuntu,随即就被我删除了,也正是因为这样,我才学会yum是怎么删除包(反悔),且把该包一并下载安装的依赖包都删除,

显示安装那个包的历史yum history list libgnomenui-devel
Loaded plugins: fastestmirror, langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     4 | install libgnomeui-devel | 2018-07-19 20:59 | Install        |   89   
history list

然后 yum history undo 4,4是ID那一列

2-安装gtk2-devel,结果还是没解决,也是反悔安装了

通过比较其他人在网上反馈的情况,我尝试重装opencv3,所以我执行了以下命令:
1.conda remove opencv
2.conda list | grep opencv 紧接着我又查了conda还包含哪些opencv包,不知道这两个包有没有影响,反正也删除了,如果有人也有的话可以尝试先不删除,看看效果再决定(^_^留言告诉我结果)
libopencv                 3.4.1                h1a3b859_1    defaults
py-opencv                 3.4.1            py36h0676e08_1    defaults

3.conda remove libopencv py-opencv
4.conda install opencv3

至此,原来的py脚本运行一切正常。





































以上是关于anaconda的python环境配置的主要内容,如果未能解决你的问题,请参考以下文章

如何在win10下配置anaconda环境变量

如何在Windows10下配置anaconda环境变量?

anaconda的python环境配置

Windows环境下安装配置Anaconda的Python开发环境

Anaconda配置Python开发环境

利用anaconda配置各种版本的python环境