How to run PyCharm in Ubuntu – "Run in Terminal" or "Run"?

Question:

When I double-click on pycharm.sh, Ubuntu lets me choose between “Run in Terminal” and “Run”. What is the difference between these options?

Asked By: AlexC

||

Answers:

To make it a bit more user-friendly:
After you’ve unpacked it, go into the directory, and run bin/pycharm.sh.
Once it opens, it either offers you to create a desktop entry, or if it doesn’t, you can ask it to do so by going to the Tools menu and selecting Create Desktop Entry…

Then close PyCharm, and in the future you can just click on the created menu entry. (or copy it onto your Desktop)

To answer the specifics between Run and Run in Terminal: It’s essentially the same, but “Run in Terminal” actually opens a terminal window first and shows you console output of the program. Chances are you don’t want that 🙂

(Unless you are trying to debug an application, you usually do not need to see the output of it.)

Answered By: sysconfig

The question is already answered, Updating answer to add the PyCharm bin directory to $PATH var, so that pycharm editor can be opened from anywhere(path) in terminal.

Edit the bashrc file,

nano .bashrc

Add following line at the end of bashrc file

export PATH="<path-to-unpacked-pycharm-installation-directory>/bin:$PATH"

Now you can open pycharm from anywhere in terminal

pycharm.sh

Answered By: Sachin G.

For Pycharm CE 2018.3 and Ubuntu 18.04 with snap installation:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop /snap/bin/pycharm-community %f

I get this command from KDE desktop launch icon.

pychar-ce-command

Sorry for the language but I am a Spanish developer so I have my system in Spanish.

Answered By: mrroot5

First, go to that folder which is containing pycharm.sh and open terminal from there. Then type

./pycharm.sh

this will open pycharm.

bin folder contains pycharm.sh file.

Answered By: Pooja Khatri

As mentioned in the above answer, by updating the bashrc file you can run the pycharm.sh from anywhere on the linux terminal.

But if you love the icon and wants the Desktop shortcuts for the Pycharm on Ubuntu OS then follow the Below steps,

 Quick way to create Pycharm launcher. 
     1. Start Pycharm using the pycharm.sh cmd from anywhere on the terminal or start the pycharm.sh located under bin folder of the pycharm artifact.
     2. Once the Pycharm application loads, navigate to tools menu and select “Create Desktop Entry..”
     3. Check the box if you want the launcher for all users.
     4. If you Check the box i.e “Create entry for all users”, you will be asked for your password.
     5. A message should appear informing you that it was successful.
     6. Now Restart Pycharm application and you will find Pycharm in Unity dash and Application launcher.."
Answered By: GangaRam Dewasi

You can launch PyCharm from terminal using pycharm-community or pycharm-professional if installed via snap. See here for more details: Location of PyCharm after install PyCharm as snap package

Answered By: PPR

Yes just go to terminal
cd Downloads
ls
cd pycharm-community-2021.2.2 (your pycharm version)
ls
cd bin
ls
./pycharm.sh

It will open your continued pycharm project

Answered By: Mandvi Bhadouriya

I did the edit and added the PATH for my Pycharm in .bashrc but I was still getting the error "pycharm.sh: command not found".
After trying several other things the following command resolved the issue which creates a symbolic link.

sudo ln -s /snap/pycharm-community/267/bin/pycharm.sh /usr/local/bin/pycharm

The first is location to the exact path to pycharm.sh and the second is user bin which should be on PATH env by default

Answered By: Ash

Official docs says if you have installed pycharm at this location: /opt/pycharm/bin/pycharm.sh then you can make it callable from terminal by using this command:

ln -s /opt/pycharm/bin/pycharm.sh /usr/local/bin/pycharm
Answered By: yakhyo

To have Bash automatically recognise the project dir you’re in:

sudo nano ~/.bashrc

OR

sudo nano ~/.bash_profile

At the bottom of the bash file:

function set_pythonpath {
    export PYTHONPATH="$(pwd):$PYTHONPATH"
}

PROMPT_COMMAND=set_pythonpath

To save and exit:

  • Ctrl + X
  • Y

Test your changes by:

cat ~/.bashrc
Answered By: DanielBell99
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.