After installing Python on your PC, we recommend that you install either an integrated development environment (IDE) or a strong text editor to write and manage your Python code. We recommend installing and using the highly popular and completely free Visual Studio Code developed by Microsoft. An alternative is PyCharm, one of the most popular Python IDEs that will assist you in writing your Python code, install additional modules, and much more. PyCharm offers a free community edition. Go to this website to download the application:
Install PyCharm
When the download is completed, run the PyCharm installation file. It is not important to change the installation destination of the PyCharm application, but you could also change the destination to be directly on your C: similarly to the Python installation. However, we suggest simply going with the default path.
On the next page, make sure to:
- Select the appropriate bit launcher for your machine
- Select the option to create associations to ".py" files
- Select the option to add launchers dir to the PATH
Selecting the option to add launchers dir to the PATH is very important. This will require you to restart your PC to complete the installation.
When the installation is complete, simply select to "Do not import settings":
Configure PyCharm and create your first project
When opening PyCharm for the first time, you are prompted with the options to install additional functionality. Simply skip this:
Before creating a new project, make sure to do the following to connect your PyCharm application to the installed Python engine. Click Configure-->Settings:
Here, navigate to "Project Interpreter" and hit the dropdown to select the interpreter for PyCharm:
Here, make sure to go to "System Interpreter" and then select the Python.exe of the just installed Python version on the C: drive:
Now, hit OK and you are ready to make your first project! Click to open a new project. You can decide whether you wish to set up a new virtual environment or simply run it using the existing standard library. We recommend, at least fpr simple test projects and if you are an inexperienced Python user, to select the option "Existing interpreter":
To get started in your new project, right-click on your project folder to create a new Python file:
You are now ready to write your first code. Open the Python Console and write something to print:
To run your code, expand the Run option in the menu:
Click to select your Python file. In the future, if you have multiple Python files in your projects, this is where you change which Python file to run when clicking run (Shift+F10):
You have now executed your first piece of Python code!
You are now ready to start learning Python. You can find endless resources online by searching for Python guides on how to write Python code. This Youtube video is quite comprehensive and covers most of the basics of the programming language.
Enabling Certain Characters
In version 2019.1 and forward of PyCharm, if you are working on a keyboard that uses the "Alt-Gr" key to send characters like | (pipe) or \ (backslash), you need to perform the following three steps in order to be able to write these characters in Pycharm.
While in the Pycharm application, hit the shortcut "Ctrl+Shift+A" to open the following subwindow.
Here, search for "Registry" and click on it.
In the next window, find the option "actionSystem.force.alt.gr" and make sure to check it.
You can now close the window and you should be able to send characters like | (pipe) and \ (backslash).
Installing Packages
One of the amazing things with Python is the endless number of packages of code that other people in the Python community have made, enabling you to perform powerful and complex commands with very few lines of code. To learn how to install additional packages using "pip", see this article:
Use the Python action in Foxtrot
If you are looking for some general information and help to use the Python action in Foxtrot in general, you can read our guide:
Comments
2 comments
Wonderful article! Straight forward
Very helpful!
Please sign in to leave a comment.