How to set default Python version in terminal on OS X 10.6.8?

前端 未结 4 1203
心在旅途
心在旅途 2020-12-13 15:11

I just downloaded python 2.7 on my mac which runs OS X 10.6.8. The previous version of python installed was 2.6.

When I type python in the terminal it o

4条回答
  •  春和景丽
    2020-12-13 15:41

    Because my account does not have the admin permission. I work around to set the config in ~/.zshrc or ~/.bashrc. Now I give a example that I assume you installed python 3.7. If you installed the other version, just change the version will be fine.

    1. ~/.zshrc solution
      $ echo "alias python=/usr/local/bin/python3.7" >> ~/.zshrc
      $ source ~/.zshrc
    
    1. ~/.bashrc solution
        $ echo "alias python=/usr/local/bin/python3.7" >> ~/.bashrc
        $ source ~/.bashrc
    
    1. check the result
        $ python --version   
        # print result Python 3.7.1
    

    The other solutions please refer to : https://opensource.com/article/19/5/python-3-default-mac

提交回复
热议问题