How can I use Homebrew to install both Python 2 and 3 on Mac?

后端 未结 9 766
遇见更好的自我
遇见更好的自我 2020-11-29 14:33

I need to be able to switch back and forth between Python 2 and 3. How do I do that using Homebrew as I don\'t want to mess with path and get into trouble. Right now I have

相关标签:
9条回答
  • 2020-11-29 15:07

    Alternatively, you probably can just enter "python3" to run your most current version of python3.x and "python" or "python2" to run the latest installed 2.x version.

    0 讨论(0)
  • 2020-11-29 15:07

    Use asdf !

    Ballad of asdf

    Once upon a time there was a programming language
    There were many versions of it
    So people wrote a version manager for it
    To switch between versions for projects
    Different, old, new.

    Then there came more programming languages
    So there came more version managers
    And many commands for them

    I installed a lot of them
    I learnt a lot of commands

    Then I said, just one more version manager
    Which I will write instead

    So, there came another version manager
    asdf version manager - https://github.com/asdf-vm/asdf

    A version manager so extendable
    for which anyone can create a plugin
    To support their favourite language
    No more installing more version managers
    Or learning more commands

    https://github.com/asdf-vm/asdf
    https://github.com/tuvistavie/asdf-python
    https://github.com/asdf-vm/asdf-plugins

    0 讨论(0)
  • 2020-11-29 15:15

    Okay, I was struggling with my brew installation of Python3, because I didn't have pip3

    sudo pip3 command not found
    

    and so I did

    brew uninstall --force --ignore-dependencies python3
    

    and installed the regular Python 3.6.2 from official distribution and then I had pip3 and all components were ok.

    0 讨论(0)
提交回复
热议问题