First Project

Python SELF EN
Level 3 , Lesson 2
Available

8.1 Exploring the IDE

So, we've created a new project. Let's figure out what's going on here.

1. Project folders and files tree:

This displays the contents of our project's folder - pythonProject.

2. Current open file:

This is just the contents of the file main.py, syntax highlighted.

3. Top menu:

Useful buttons on the top right:

  • "Green triangle" - run project button.
  • "Bug" - start debug mode button.
  • "Magnifier" - project search.
  • "Gear" - settings.

4. Sidebar on the left:

There are a few useful buttons there, one of particular interest is the Terminal button.

5. Status bar:

On the left of the status bar is the path to the current open file. On the right is its encoding: CRLF, UTF-8.

And all the way to the right is the current version of Python - Python 3.12.x which will run our project. It's useful to check this out if you've got several different Python versions installed on your system, and have projects that run on other versions.

8.2 Project Breakdown

A standard project consists of files shown on the left panel. These files can be roughly divided into 4 parts.

Python code files. These files have a .py extension and PyCharm marks them with a blue-yellow icon. In our project, there's currently only one such file - main.py

Static files. These are files that contain data, not code. These might be text files, images, media files, etc. We currently don't have any in our project.

Python virtual environment. In a folder named .venv (short for Virtual Environment) are files for Python and some utility tools. The package manager pip will also download third-party libraries you want to use here.

External libraries. Currently, there aren't any in our project, but when you download them, PyCharm will definitely show them here.

8.3 Virtual Environment — venv

Let's talk a bit more about the virtual environment. venv is a module in Python that lets you create lightweight and isolated virtual environments for Python projects. It's a tool that helps manage project dependencies, isolating them from system libraries.

Each virtual environment has its own Python executables and space for installing libraries, ensuring projects are independent from one another.

This is especially useful when different projects require different versions of the same library, or when you need to avoid conflicts between system libraries and libraries needed for a specific project.

8.4 Working with the Terminal

In PyCharm, you can work directly with the command line of your OS. In Linux and MacOS, the command line is called Terminal, so in PyCharm they call it the same. It's not just a whim of PyCharm, but a standard name among programmers.

To open the Terminal you need to click on the terminal button in the side menu:

You should see a window like this:

In this window, you can write commands for your operating system. We're interested in one of them.

Let's find out the current version of the Python interpreter we've installed. To do this, you need to type:


        python --version

Here's what I got:

If you also got Python 3.12.x, then we're on the right track.

Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION