[英]Homebrew installation of OpenCV 3.0 not linking to Python
When I install OpenCV 3.0 with Homebrew, it gives me the following directions to link it to Python 2.7: 当我用Homebrew安装OpenCV 3.0时,它给了我以下指示将它链接到Python 2.7:
If you need Python to find bindings for this keg-only formula, run:
如果您需要Python来查找此仅keg公式的绑定,请运行:
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pthecho /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
While I can find the python2.7 site packages in opencv3, no python34 site packages were generated. 虽然我可以在opencv3中找到python2.7站点包,但是没有生成python34站点包。 Does anyone know how I can link my OpenCV 3.0 install to Python 3?
有谁知道如何将我的OpenCV 3.0安装链接到Python 3?
It's weird that there is no concise instruction for installing OpenCV 3 with Python3. 奇怪的是,没有关于使用Python3安装OpenCV 3的简明指令。 So, here I make it clear step-by-step:
所以,我在这里一步一步地说清楚:
brew install python3
brew install python3
brew tap homebrew/science
brew tap homebrew/science
Install any Python3 packages using pip3
. 使用
pip3
安装任何 Python3包。 This will create the site-packages
folder for Python3 For example: pip3 install numpy
这将为Python3创建
site-packages
文件夹例如: pip3 install numpy
Then install OpenCV3 brew install opencv3 --with-python3
然后安装OpenCV3
brew install opencv3 --with-python3
site-packages
folder created in Step 2. Just run the following command to link Opencv3 to Python3: echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth
site-packages
文件夹。只需运行以下命令将Opencv3链接到Python3: echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth
You may have to change the above command correpondingly to your installed Homebrew Python version (eg 3.4). 您可能必须相应地更改上面的命令到您安装的Homebrew Python版本(例如3.4)。
You need to install opencv like brew install opencv3 --with-python3
. 你需要像
brew install opencv3 --with-python3
一样安装opencv。 You can see a list of options for a package by running brew info opencv3
. 您可以通过运行
brew info opencv3
查看包的选项列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.