How can I make homebrew's python and pyenv live together?

后端 未结 4 1512
北海茫月
北海茫月 2020-12-22 22:56

After switching to python 3.4.3 from 2.7.9 (which was quite simple), I often wish to test some of my scripts with python 2.7.9 before sharing them with colleagues. I am usin

4条回答
  •  孤城傲影
    2020-12-22 23:35

    Just to add to @johnizzo1's answer, python2 is now python@2, so you should change the python3 for loop to something like:

    for i in `ls $(brew --cellar python)/`; do 
      ln -s $(brew --cellar python)/$i $HOME/.pyenv/versions/$i-brew; 
    done
    
    for i in `ls $(brew --cellar python@2)/`; do 
      ln -s $(brew --cellar python@2)/$i $HOME/.pyenv/versions/$i-brew; 
    done
    

提交回复
热议问题