在OS-X Mavericks上安装了OpenCV但未链接的错误消息

时间:2014-01-15 15:07:15

标签: python macos opencv homebrew osx-mavericks

当我发出以下命令时

brew install homebrew/science/opencv

brew install opencv 

我收到以下消息。

Warning: opencv-2.4.7.1 already installed, it's just not linked

知道如何解决这个问题。 我已根据链接在.bash_profile中有以下内容。

Installing openCV 2.4.2 on Mac OS X 10.9 (Mavericks)

export PYTHONPATH=/usr/local/Cellar/opencv/2.4.6.1/lib/python2.7/site-packages:$PYTHONPATH

Linking Python with Open CV on Mac

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH 

当我使用以下命令进行链接时,出现以下错误。

$brew link opencv
Linking /usr/local/Cellar/opencv/2.4.7.1... Warning: Could not link opencv. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/opencv/2.4.7.1/lib/pkgconfig/opencv.pc
/usr/local/lib/pkgconfig is not writable. You should change its permissions.

任何想法如何解决这个问题?

感谢。

3 个答案:

答案 0 :(得分:2)

我用brew链接解决了问题--overwrite --dry-run opencv

答案 1 :(得分:2)

我遇到了同样的问题。按照上面提到的帖子,我通过chown建议的一系列brew doctor命令解决了这个问题。 这是我使用brew doctor

时得到的结果
Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man/de
    /usr/local/share/man/de/man1
    /usr/local/share/man/mann

所以我改变了这些文件夹。

之后我使用brew link --overwrite opencv

现在当我输入brew链接opencv时,它会显示

Warning: Already linked: /usr/local/Cellar/opencv/2.4.11
To relink: brew unlink opencv && brew link opencv

我认为它有效。

答案 2 :(得分:2)

我通过使用来解决这个问题 sudo chown -R $USER /usr/local/lib/python2.7/site-packages

然后 brew link numpy