【问题标题】:Install OpenCV on Mac - VirtualEnv (Updated bash_profile and pip error)在 Mac 上安装 OpenCV - VirtualEnv(更新 bash_profile 和 pip 错误)
【发布时间】:2016-02-15 01:37:08
【问题描述】:

我正在尝试使用 this 教程在我的 Mac (OS X 10.11.3) 上安装 OpenCV,因为它使用 VirtualEnv,这是一种确保开发一致性的方法。

我跳过了第 1 步和第 2 步,因为我已经有了 Xcode 和 Homebrew。第 3 步运行良好(按照说明更新 ~/.bash_profile 后):

User:~ user$ brew update
Already up-to-date.
User:~ user$ source ~/.bash_profile
User:~ user$ which python
/usr/local/bin/python
User:~ user$ 

问题出在第 4 步:

User:~ user$ pip install virtualenv virtualenvwrapper
-bash: /usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
User:~ user$

这可能是因为我在本地垃圾箱中,因为在第 3 步中将此添加到 ~/.bash_profile

# Homebrew
export PATH=/usr/local/bin:$PATH

这基本上意味着我无法从该位置访问 pip,但是当我尝试在本地安装它时(在~/.bash_profile 中添加了上述行),它说:

User:~ user$ brew install pip
Error: No available formula with the name "pip" 
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:

  https://pip.readthedocs.org/en/stable/installing/#install-pip
User:~ user$

如何使用第 3 步中更新的~/.bash_profile 访问 pip?谢谢!

【问题讨论】:

    标签: macos opencv pip homebrew .bash-profile


    【解决方案1】:

    好的,我发现了问题。

    我遇到了与this stackoverflow 问题相同的错误,所以我运行了推荐的

    brew link python
    

    遇到了和thisstackoverflow问题一样的错误,所以我跑了推荐

    brew link --overwrite python
    

    这似乎解决了问题并允许我在首先访问 Homebrew 包时运行 pip。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-26
      • 2016-10-12
      • 2016-08-07
      • 1970-01-01
      • 2017-04-05
      • 2013-09-03
      • 1970-01-01
      相关资源
      最近更新 更多