All Tracks/lecture python installation/
Đang tải...
Hướng dẫn thử thách
1 / 3

How Do You Install, Configure and Use Python in Your Local Environment?

For all of the workshops and labs, you will be using freeCodeCamp's Python editor. But it is important to learn how to set up Python on your local machine. The easiest way to install Python on Windows and Mac is to download the installer from the official Python website. We'll also go over running Python on Linux later in this lesson. Go to `https://www.python.org/` and hover over "Downloads". A modal will appear showing the current version of Python for your operating system (OS). We'll go over how to install Python on a computer running macOS first: - Click on the button showing the current version of Python (from the previous modal), and you'll start downloading a `.pkg` installation file automatically. - Once the `.pkg` installer is finished downloading, open it, then click "Continue" in the window that opens up. - Continue clicking the "Continue" button until you get to the "Installation Type" section. There, click the "Install" button. - Enter your password if necessary, then start the installation. - After that, you should get a congratulations message saying that Python has been successfully installed. - Click the "Close" button, and you're done! You can verify the installation by opening up your terminal and running `python --version` or `python3 --version`. You can also open the Python interpreter by running `python` or `python3` in the terminal. A Python interpreter is the program that reads Python code, translates it into instructions the computer understands and executes those instructions. A <dfn>terminal</dfn> is a text-based interface that lets you interact with your computer by typing commands. Each operating system comes with a default terminal app. On macOS, you can use the Terminal app. On Windows, you can use Command Prompt or PowerShell. On Linux, each desktop environment has its own default terminal app, like GNOME Terminal or Konsole. Note that, on some older macOS and Linux systems, `python` can be reserved for Python 2, while `python3` is for Python 3 specifically. If you run `python --version` and see a version of Python 2 like `Python 2.7.18`, then it's possible that your OS relies on some software that was written in the older version of Python. If that's the case, you should use `python3` to run your Python code going forward. Python 2 is end-of-life and should not be used for any new development. To install Python on Windows, follow these steps: - Go to `https://www.python.org/`, and hover over “Downloads“. You should see a modal that says "Download for Windows" and a download button with the current version of Python. - Click on the version number, and you'll start downloading a Windows executable (`.exe`) file automatically. - Once you've finished downloading the Python installer for Windows, double-click on it, and follow the instructions. - When you see the option `Add python.exe to Path`, check that option, then click `Install Now`. Doing that will make things easier for you later. You can verify the installation by opening up a command line shell like PowerShell and running `python --version`. You can also open the Python interpreter by running `python`. For Python on Linux, most major distros like Ubuntu, Debian, and Fedora come with Python. Just open a terminal and run `python --version`, or `python3 --version`: If either command doesn't show a version of Python, you can search for an installation package for your flavor of Linux at `https://www.python.org`, or search online for the recommended way to install Python for your distro.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.sh
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.