We'll start this course by setting up Python. It can be downloaded and installed from the official Python website, but it is better to do this using a package manager.
To begin, open a terminal and run the command appropriate for your operating system:
The command for Ubuntu or Ubuntu on Windows (WSL) is:
sudo apt update sudo apt install python3
Command for MacOS is:
# https://brew.sh/index_ru.html brew install python
Now is a time to make sure Python is installed and properly working. To do this, type python3 --version
in a terminal. The output should look like this:
Make sure you have at least 3.8
installed.
To learn successfully, you need to practice. Type out all the code from the tutorial and run it locally. It is the only way to understand what is going on.
In cases where an interactive interpreter isn't enough, we should run code as files. To do this, create a file with any name and a .py
extension, and then run it:
We should run the code from the same directory as the main.py
file. If you don't start from the same directory, you need to specify the path to the file.
The pyenv utility
A completely different way to install Python is to use the pyenv utility (for Windows users, you will need a specific version of the utility — pyenv-win).
In addition to installing any version of Python, this utility allows you to switch between versions easily. It may be convenient if you're working on several projects that require you to use different versions of Python at the same time.
Recommended materials
Are there any more questions? Ask them in the Discussion section.
The Hexlet support team or other students will answer you.
For full access to the course you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.