PyCharm
Introduction
PyCharm is an integrated development environment for the Python programming language. It provides code analysis tools, a graphical debugger, a unit test runner, and supports web development in
Django. PyCharm is developed by JetBrains based on IntelliJ IDEA.
PyCharm is a cross-platform development environment compatible with
Windows, macOS,
Linux. PyCharm Community Edition (free) is licensed under the Apache License, while PyCharm Professional Edition (paid) is proprietary software.
For support of the
Robot Framework
in PyCharm, you can read about
here
| Installing with pip |
| Installing on Linux |
Install a module in PyCharm
Let's look at how to install additional modules and libraries in PyCharm using requests as an example.
Go to the project settings by clicking
CTRL + ALT + S
Find the Project: name of your project section
Select the Project Interpreter or Python Interpreter subsection
Click the plus sign on the right side of the screen
The Available Packages window should appear.
Enter the name of the desired module in the search bar. In my case, it's requests
Click the Install Package button
Wait for the installation to complete
Check the virtual environment
If you're running a script in PyСharm examine the terminal output
/home/andrei/pytest/venv/bin/python /home/andrei/pytest/main.py
Process finished with exit code 0
/home/andrei/pytest/venv/bin/python
- this is the path to the Python used.
If the script were run by the default Python
/usr/bin/python3.8
Disable automatic activation of the environment
To stop PyCharm from automatically activating the virtual environment when you navigate to a directory, uncheck the Activate virtualenv box in
Settings → Tools → Terminal → Application Settings → Activate virtualenv
https://aredel.com
Add Git Bash to the PyCharm Terminal
If you want to use Git Bash inside the PyCharm window, select
File → Settings → Tools → Terminal
And set Shell path: as
C:\Users\Andrei\AppData\Local\Programs\Git\bin\bash.exe
Then, when you click +, a new Git Bash will appear in the terminal toolbox, while other consoles will still be accessible from the drop-down menu.
If you set Shell path as
C:\Users\Andrei\AppData\Local\Programs\Git\git-bash.exe
Then when you click + Git Bash will open in a separate window.
If you plan to activate virtual environments manually, I recommend disabling automatic virtual environment activation
Bash commands disappear in Git Bash terminal after activation
If you added Git Bash as a terminal in PyCharm and after activating the virtual environment, bash commands stop working. For example, ls
ls
bash: ls: command not found
I recommend checking to see if automatic virtual environment activation is disabled.
Settings → Tools → Terminal → Application Settings → Activate virtualenv
It is possible that double activation is occurring, so disabling this option will return the bash commands.
Switch between terminal tabs
The key combination depends on the operating system.
I have
Windows 11
and it works.
Alt + →
Alt + ←
| PyCharm: IDE | |
| Install | |
| Add Path to Project | |
| Editor Basics | |
| Python | |
| Add Selenium to PyCharm |