How to set Python's default version to 3.x on OS X?

前端 未结 21 1943
滥情空心
滥情空心 2020-11-22 07:52

I\'m running Mountain Lion and the basic default Python version is 2.7. I downloaded Python 3.3 and want to set it as default.

Currently:

$ python
           


        
21条回答
  •  一整个雨季
    2020-11-22 08:25

    On MacOS

    Step-1: Upgrade python to latest version by: $ brew upgrade python

    Step-2: Go to home: $ cd

    Step-3: open .bash_profile

    $ vi .bash_profile

    Setting PATH for Python 3.8

    PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}" export PATH

    Step-4: Save the file. And compile it by:

    $ . .bash_profile

    Step-5: Check the python version:

    $ python -V

    Step-6: Thats all.

提交回复
热议问题