Command-line interface
Use PyCharm features from the command line: open files and projects, view diffs, merge files, apply code style, formatting, and inspect the source code.
For information about running command-line tools from inside PyCharm, see Terminal emulator.
Launcher for a standalone instance
The installation directory contains batch scripts and executables for launching PyCharm, formatting the source code, and running inspections. To use them from the Command Prompt cmd.exe , add the location of the PyCharm bin folder to the PATH environment variable. For example, if you installed PyCharm to C:\Program Files\JetBrains\PyCharm , you can use the following command:
This command changes the PATH environment variable for the current shell only (the current instance of cmd.exe ). If you want to update it permanently for the current user, run setx :
To update it system-wide for all users, run setx /M instead of setx .
The installer can do this for you if you select Add launchers dir to the PATH on the Installation Options step of the setup wizard.
After you configure the PATH variable, you can run the executable from any working directory in the Command Prompt: pycharm64.exe . Alternatively, you can use the batch script: pycharm.bat .
To run PyCharm from the shell, use the open command with the following options:
-a : specify the application.
—args : specify additional arguments when passing more than just the file or directory to open.
-n : open a new instance of the application even if one is already running.
For example, you can run PyCharm.app with the following command:
If PyCharm is not in the default /Applications directory, specify the full path to it.
You can create a shell script with this command in a directory from your PATH environment variable. For example, create the file /usr/local/bin/pycharm with the following contents:
Make sure you have permissions to execute the script and since /usr/local/bin should be in the PATH environment variable by default, you should be able to run pycharm from anywhere in the shell.
On Linux, the installation directory contains the launcher shell script pycharm.sh under bin . For example, if you installed PyCharm to /opt/pycharm , you can run the script using the following command:
You can create a symbolic link to the launcher script in a directory from the PATH environment variable. For example, if you installed PyCharm to /opt/pycharm and want to create a link named pycharm in /usr/local/bin , run the following command:
Since /usr/local/bin should be in the PATH environment variable by default, you should be able to run the pycharm command from anywhere in the shell.
If you installed PyCharm as a snap package, you can use the corresponding launcher: pycharm-professional or pycharm-community .
Shell scripts generated by the Toolbox App
If you are using the Toolbox App to install and manage JetBrains products, you can use shell scripts for launching your IDEs from the command line.
Toolbox App generates shell scripts automatically and places them to the following folders:
By default, the Toolbox App puts shell scripts in a directory from the system PATH environment variable, so you can run the name of the script as a command to launch PyCharm from any working directory.
Change shell scripts location
Open the Toolbox App, click the Toolbox App menu icon in the top right corner, and select Settings .
On the Settings tab, expand the Tools section, and specify another folder in the Shell scripts location field.
Rename shell scripts
If you have several versions of the same IDE, the Toolbox App generates a shell script for each version with a unique name. You can change the name of the shell script for an IDE instance in the settings for this specific instance.
Open the Toolbox App.
Click next to an IDE instance and select Settings .
At the bottom of the Configuration section, change the Shell script name field.
By default, the Toolbox App puts shell scripts in a directory from the system PATH environment variable, so you can run the name of the script as a command to launch PyCharm from any working directory.
Change shell scripts location
Open the Toolbox App, click the Toolbox App menu icon in the top right corner, and select Settings .
On the Settings tab, expand the Tools section, and specify another folder in the Shell scripts location field.
Rename shell scripts
If you have several versions of the same IDE, the Toolbox App generates a shell script for each version with a unique name. You can change the name of the shell script for an IDE instance in the settings for this specific instance.
Open the Toolbox App.
Click next to an IDE instance and select Settings .
At the bottom of the Configuration section, change the Shell script name field.
By default, the Toolbox App puts shell scripts in a directory from the system PATH environment variable, so you can run the name of the script as a command to launch PyCharm from any working directory.
Change shell scripts location
Open the Toolbox App, click the Toolbox App menu icon in the top right corner, and select Settings .
On the Settings tab, expand the Tools section, and specify another folder in the Shell scripts location field.
Rename shell scripts
If you have several versions of the same IDE, the Toolbox App generates a shell script for each version with a unique name. You can change the name of the shell script for an IDE instance in the settings for this specific instance.
Open the Toolbox App.
Click next to an IDE instance and select Settings .
At the bottom of the Configuration section, change the Shell script name field.
Command-line arguments
The launcher script accepts commands, options, and other arguments to modify its behavior:
Without any arguments, the script launches PyCharm.
Path to file or directory
Open the file or directory specified as the argument.
Commands
Open the diff viewer to see the differences between two specified files.
Open the Merge dialog to merge the specified files.
Apply code style formatting to the specified files.
Perform code inspection on the specified project.
Options
Do not show the splash screen when loading PyCharm.
Do not reopen projects and show the welcome screen. This can help if a project that was open crashes PyCharm.
Do not load manually installed plugins. This can help if a plugin that you installed crashes PyCharm. You will be able to start the IDE and either disable or uninstall the problematic plugin.
Configure PyCharm With the Python Virtual Environment
![]()
It will show you how to configure PyCharm to work with Python in a virtual environment. Also you will configure the requirements.txt.
Start PyCharm create a new project or clone it from your repository. As an example I created a file first_example.py to write inside the main. I specify that this is only an example and for reasons of brevity does not follow the structure of a Python project.
Install Python
First, make sure Python 3 is installed by running the following command:
If python 2 and 3 is installed, the output will be the installed version of python 2 and 3.
If python is not installed, run the command and choose version 3.6 for example¹:
Create virtualenv with:
It is possible to create virtualenv on the same directory or on a different directory. In this article I use the same directory as the project directory. In my case i call the directory “venv”, but we can use “any_name”:
If all went well you will have the folder venv in your project:
To activate virtual environment lunch:
The fact that there is venv in parenthesis means that all libraries will be installed in the virtual environment and will not “dirty” the global environment. For more information about the virtual environment read this https://docs.python.org/3/tutorial/venv.html.
Python Interpreter
If you can’t find the python interpreter in the previous window then you have to create or add it. Just go to File →Settings →Project →Python interpreter →Add.
In the Interpreter box is present the path of our virtual environment:
Click Ok and then on Apply, then we will see all the libraries installed in our virtual environment.
Executing a program in the virtual environment
Let’s consider the example first_example, go to Add Configuration…
A window will open. Click on the “+” in the upper left corner. Now we can configure our Python program ready to run. Enter the “Name” (first_example), set “Script path” to the file where the main is located. Then we should find the “Python interpreter” already configured, in any case, having added it we will find it in the dropdown menu. Note that the interpreter path is the one related to the virtual environment created!
Lunch simple program
Let’s consider the following code:
requirements.txt
If you share a project with other users using a build system or plan to copy the project to another location where an environment is to be restored, you must specify the external packages required by the project. The recommended approach is to use a requirements.txt file, which contains a list of pip commands and allows you to install the required versions of dependent packages.
We assume to install Pandas (data analysis and manipulation tool), we lunch:
Script path pycharm что писать
Upper right corner of the interface, the left button has run drop-down box, displayed under normal circumstances is currently editing the script file (.py).
If not, the script will not run, you need to configure the script path let Pycharm know you want to run this script.

After the drop-down choose Edit Configuration .

(Yellow arrow) will fill in the path above the path for the script file, the following script that will automatically fill in the folder. Click OK OK.
Script path pycharm что писать
Reddit and its partners use cookies and similar technologies to provide you with a better experience.
By accepting all cookies, you agree to our use of cookies to deliver and maintain our services and site, improve the quality of Reddit, personalize Reddit content and advertising, and measure the effectiveness of advertising.
By rejecting non-essential cookies, Reddit may still use certain cookies to ensure the proper functionality of our platform.
For more information, please see our Cookie Notice and our Privacy Policy .
Get the Reddit app
Subreddit for JetBrains PyCharm, the Python IDE for professional developers by JetBrains. Find out more about PyCharm at https://www.jetbrains.com/pycharm/
Is it possible to set up pycharm so that every time I create a new file within a project it automatically makes it executable?
Currently I have to go to edit configurations, add a new configuration, change the script path and title. etc.
Is there a way to make pycharm do this automatically for new files within a project? Ideally when I switch between .py files on the left browser it would also change automatically which code is to be executed so I don't need to use the drop down. I find this whole default set up a bit odd, I'm sure it will make sense long term, but for now I would just like everything to be as easy as possible, even if it's not the best way to do things.