简体   繁体   English

Mac OSX 10.10找不到opencv库

[英]Mac OSX 10.10 cannot find opencv library

I'm trying to install a package (pyfacetracker in case anyone is curious) and am having trouble getting it to find the opencv libraries when I run setup.py build. 我正在尝试安装一个软件包(如果有人好奇,请使用pyfacetracker),并且在运行setup.py build时无法找到它以找到opencv库。

ld: library not found for -llibopencv_core.2.4.11.dylib

In the error message (g++ -bundle undefined dynamic lookup), I found the following: 在错误消息(g ++ -bundle未定义的动态查找)中,我发现了以下内容:

-L/usr/local/lib -L/Users/xxx/anaconda/lib -llibopencv_core.2.4.11.dylib

I had installed opencv version 2.4.11 with brew and checked to make sure the libraries were where they were supposed to be (in /usr/local/lib). 我已经用brew安装了opencv版本2.4.11,并检查以确保库位于它们应该在的位置(在/ usr / local / lib中)。 Since it seemed that it was also searching for the library in /anaconda/lib, I installed opencv through conda and updated the setup.py file to reflect the version change (conda installed 2.4.8). 由于似乎它也在/ anaconda / lib中搜索该库,因此我通过conda安装了opencv并更新了setup.py文件以反映版本更改(conda已安装2.4.8)。 This still yielded no results. 这仍然没有结果。

I then tried running the following commands in 3 different directors (/usr/local/lib, /usr/local/Cellar/opencv/2.4.11_1/lib, and /Users/xxx/anaconda/lib to figure out where ld was looking for the libraries 然后,我尝试在3个不同的控制器(/usr/local/lib、/usr/local/Cellar/opencv/2.4.11_1/lib和/ Users / xxx / anaconda / lib)中运行以下命令,以确定ld在寻找什么用于图书馆

ld -L/usr/local/Cellar/opencv/2.4.11_1/lib -llibopencv_core.2.4.11.dylib

I got back the exact same error as when I ran setup.py build. 我找回与运行setup.py build时完全相同的错误。

I also have tried changing the name (ie -lopencv_core instead of -llibopencv_core) but still have had no luck. 我也尝试过更改名称(即-lopencv_core而不是-llibopencv_core),但仍然没有运气。 Can anyone please help me out? 有人可以帮我吗? Thanks! 谢谢!

I figured out the answer. 我想出了答案。 In case anyone is wondering, in osx, you'll want to exclude the lib (so -lopencv_core). 如果有人想知道,在osx中​​,您将要排除lib(所以-lopencv_core)。 Also, -l automatically assumes the .dylib extension, so you'll want to leave that out. 另外,-l自动采用.dylib扩展名,因此您将忽略该扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM