似乎openCV已被激活,但使用iPython Jupyter Notebook导入cv2 时出现错误消息:没有名为cv2的模块。但是,使用终端是好的。
Macbook:// Macbook$ source activate opencv
(opencv) Macbook:// Macbook$ python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import cv2
>>>
答案 0 :(得分:0)
也许您忘记将其导出到环境中。尝试:
export PYTHONPATH
答案 1 :(得分:0)
我尝试了这个,它在我的一个Macbook上工作,但不是另一个......: 无论如何,希望这可能会有所帮助, 虽然我的问题尚未解决: “conda install -c https://conda.binstar.org/menpo opencv3” 在Anaconda Prompt窗口中,但这次不在opencv环境中。 ,来自https://rivercitylabs.org/up-and-running-with-opencv3-and-python-3-anaconda-edition/
中的评论这意味着,
source deactivate opencv
conda install -c https://conda.binstar.org/menpo opencv3
但请注意,该链接提供了不同的步骤。不要跟着它。它告诉我们要做
conda create -n opencv numpy scipy scikit-learn matplotlib python=3
source activate opencv
conda install -c https://conda.binstar.org/menpo opencv3
答案 2 :(得分:0)
使用包virtualenv和virtualenvwrapper在虚拟环境中安装python和opencv,可以找到详细解释here
然后在该虚拟环境中使用jupyter notebook,然后导入cv2应该可以工作。