Environmental installation

  • Install Python on macOS

    • Automatic installation method one — Homebrew

      Brew install Python # Then install prompt, central configure environment variables, add Python to PATHCopy the code

       

    • Automatic installation two (using Pyenv, which makes it easier to install other versions of Python at a later date)

      Brew install Pyenv # Install python version management tool (similar to NVM, RVM, jenv) pyenv install 3.8-dev # install Python 3.8 pyenv global 3.8-dev # configure default Pyenv init # execute the init command as prompted to load pyenv into shell # Profile export PYENV_ROOT="$HOME/. Pyenv "export PATH="$PYENV_ROOT/bin:$PATH" eval "$(Pyenv Init -- PATH)" # ~/.bashrc pyenv eval "$(pyenv init -)" Profile and ~/.zprofile files export PYENV_ROOT="$HOME/. Pyenv "export PATH="$PYENV_ROOT/bin:$PATH" eval "$(Pyenv) # pyenv eval "$(pyenv init -)"Copy the code
    • Manual installation

      Open the python’s official website, click on the download link www.python.org/downloads/, find the download button, download the installation package to install.

       

  • Windows

    • scoopAutomatic installation

      Scoop Install Python # That's itCopy the code

       

    • Manual installation

      Open the python’s official website, click on the download link www.python.org/downloads/, find the download button, download the installation package to install.

IDE

  • Visual Studio Code (recommended)

    • macOS

      • Click the Download link and select your own version to download and install, unzip it and drag it into the Applicaitons folder

      • Install using Homebrew

         brew install --cask visual-studio-code
        Copy the code
    • Windows

      Click the download link and choose your own system version to download and install

    • Vscode configuration

      1. Create a new file and click on the bottom corner of the editor for Plain Text

      1. In the pop-up window, type Python and press Enter

      1. In the dialog box that is displayed, selectInstall, this will installpythonThe plug-in

      1. The installationpythonThe plug-in

      1. If you have not installed Python before, select the first one and click button to continue

      1. If you have already installed itpython, select the second configurationpythonThe parser

      7. Then select the one you installpythonIf there are multiple paths, select onepython3The latest version

      1. To test whether the installation is successful, enter it in the file

        print("hello world!" )Copy the code

         

      1. Right-click the file and select Run Selection/Line in Python Terminal

      1. If the following information is displayed, the installation is successful

       

  • PyCharm community edition

    Click *** download link *** download installation, pay attention to select the community version

    1. Once the installation is successful, open PyCharm and select New Project

    1. First Pure Python, then configure your Python parser, using either of the red boxes