如何照顾Brew Doctor警告

时间:2018-05-25 05:50:41

标签: python macos homebrew

因为我无法通过pyenv global更改python版本,所以我重新安装了pyenv和python。现在我收到了这个警告。之前我已经通过引用其他文章解决了这个问题,尽管我假设在.bash_profile中设置错误使pyenv全局无效。我是全新的。任何帮助让我理解警告并解决问题将不胜感激。感谢

Macbooks-MacBook-Pro:~ macbookpro$ brew doctor

有额外的 如果配置脚本覆盖系统或Homebrew提供的同名脚本,则路径中的脚本可能会混淆通过Homebrew安装的软件。我们发现以下" config"脚本:

/Users/macbookpro/.pyenv/shims/python-config   
/Users/macbookpro/.pyenv/shims/python2-config   
/Users/macbookpro/.pyenv/shims/python2.7-config   
/Users/macbookpro/.pyenv/shims/python3-config   
/Users/macbookpro/.pyenv/shims/python3.6-config   
/Users/macbookpro/.pyenv/shims/python3.6m-config

Macbooks-MacBook-Pro:~ macbookpro$ which pyenv    /usr/local/bin/pyenv 
Macbooks-MacBook-Pro:~ macbookpro$ which brew   /usr/local/bin/brew   
Macbooks-MacBook-Pro:~ macbookpro$ pyenv versions   
 system  
  2.7.15  
* 3.6.5 (set by /Users/macbookpro/.python-version)  

Macbooks-MacBook-Pro:~ macbookpro$ open -e .bash_profile           
if which pyenv > /dev/null; then
  eval "$(pyenv init -)";
  fi   export PYENV_ROOT="$HOME/.pyenv"   export 
  PATH="$PYENV_ROOT/bin:$PATH"   eval "$(pyenv init -)"  

Macbooks-MacBook-Pro:~ macbookpro$ python --version   Python 3.6.5   
Macbooks-MacBook-Pro:~ macbookpro$ pyenv global 2.7.15
Macbooks-MacBook-Pro:~ macbookpro$ pyenv global                   
2.7.15 .                           
Macbooks-MacBook-Pro:~ macbookpro$ python --version              
Python 3.6.5    
Macbooks-MacBook-Pro:~ macbookpro$ which python                     /Users/macbookpro/.pyenv/shims/python

2 个答案:

答案 0 :(得分:0)

尝试将以下别名添加到源文件中

alias brew ='env PATH = $ {PATH // $(pyenv root)/ shims:/} brew'

答案 1 :(得分:0)

可以改进别名:

alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'

以防$ PATH包含空格。