gpt4 book ai didi

python - 无法在 macOS 上的 Anaconda3 python3.6 上安装 OpenCV3

转载 作者:IT老高 更新时间:2023-10-28 21:06:21 25 4
gpt4 key购买 nike

我正在尝试在 macOS 10.11.6 上的 Anaconda3 python 3.6 上安装 OpenCV 3.2.0,但我找不到方法。我的 Anaconda3 安装了 python 3.5.2,但是如果我使用

创建一个新的虚拟环境
$ conda create -n myvenv python  
then it downloads and installs python 3.6 on the new myvenv. A simple search
$ conda search opencv
opencv 2.4.8 np17py27_2 defaults

opencv3 没有结果

$ conda search opencv3
NoPackagesFoundError: Package missing in current osx-64 channels:
- opencv3

安装menpo opencv3 build会产生以下冲突:

$ conda install -c menpo opencv3
Fetching package metadata ...........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- opencv3 -> python 2.7* -> openssl 1.0.1*
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.

我尝试使用自制软件进行安装,但将其与 Anaconda3 python3 链接似乎很困难:

$ brew install eigen tbb
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/eigen-3.3.1.el_capitan.bottle.tar.gz
100.0%
==> Pouring eigen-3.3.1.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/eigen/3.3.1: 486 files, 6.4M
==> Downloading https://homebrew.bintray.com/bottles/tbb-4.4-20161128.el_capitan.bottle.tar.gz
100.0%
==> Pouring tbb-4.4-20161128.el_capitan.bottle.tar.gz
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/<username>/.local/lib/python3.5/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/<username>/.local/lib/python3.5/site-packages/homebrew.pth
==> Summary
🍺 /usr/local/Cellar/tbb/4.4-20161128: 119 files, 1.9M

更多信息

$ conda info
Current conda install:
platform : osx-64
conda version : 4.3.8
conda is private : False
conda-env version : 4.3.8
conda-build version : 2.0.2
python version : 3.5.2.final.0
requests version : 2.12.4
root environment : /Users/<username>/anaconda3 (writable)
default environment : /Users/<username>/anaconda3/envs/lesvenv
envs directories : /Users/<username>/anaconda3/envs
package cache : /Users/<username>/anaconda3/pkgs
channel URLs : https://repo.continuum.io/pkgs/free/osx-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/osx-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/osx-64
https://repo.continuum.io/pkgs/pro/noarch
config file : None
offline mode : False
user-agent : conda/4.3.8 requests/2.12.4 CPython/3.5.2 Darwin/15.6.0 OSX/10.11.6
UID:GID : 502:20

而结尾列表是:

$ conda list
packages in environment at /Users/<username>/anaconda3/envs/lesvenv:
anaconda-client 1.6.0 py36_0
clyent 1.2.2 py36_0
mkl 2017.0.1 0
numpy 1.11.3 py36_0
openssl 1.0.2j 0
pip 9.0.1 py36_1
python 3.6.0 0
python-dateutil 2.6.0 py36_0
pytz 2016.10 py36_0
pyyaml 3.12 py36_0
readline 6.2 2
requests 2.12.4 py36_0
setuptools 27.2.0 py36_0
six 1.10.0 py36_0
sqlite 3.13.0 0
tk 8.5.18 0
wheel 0.29.0 py36_0
xz 5.2.2 1
yaml 0.1.6 0
zlib 1.2.8 3

我的 python 是:/Users/<username>/anaconda3/bin/anaconda
我的 python 3.5.2 是:/Users/<username>/anaconda3/bin/python
我的 conda myvenv python 3.6 是:/Users/<username>/anaconda3/envs/myvenv/bin/python

最佳答案

这个答案现在已经过时了(除非出于某种原因您想使用旧版本的 OpenCV)- 请参阅 this answer

上述正确答案对我不起作用。

最终降低了 python 的版本,直到这个问题得到解决。

conda install python=3.5
conda install -c menpo opencv3

我知道这不是永久修复,但这对我有用,您无需做太多就可以留在 conda 环境中。

此问题目前在此处引用:https://github.com/conda/conda/issues/2448

希望这会有所帮助!

关于python - 无法在 macOS 上的 Anaconda3 python3.6 上安装 OpenCV3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41873941/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com