Python 如何在 Ubuntu 中运行 PyCharm - “在终端中运行”还是“运行”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27063361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 01:23:18  来源:igfitidea点击:

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

pythonubuntupycharm

提问by AlexC

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

当我双击 pycharm.sh 时,Ubuntu 让我在“在终端中运行”和“运行”之间进行选择。这些选项有什么区别?

采纳答案by sysconfig

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 Toolsmenu and selecting Create Desktop Entry...

为了使它更加用户友好: 解压后,进入目录,然后运行bin/pycharm.sh. 打开后,它会提示您创建桌面条目,如果没有,您可以通过转到“工具”菜单并选择“创建桌面条目...

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

然后关闭 PyCharm,以后您只需单击创建的菜单项即可。(或将其复制到桌面上)

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 :)

回答 Run 和 Run in Terminal 之间的细节:本质上是一样的,但“在终端中运行”实际上首先打开一个终端窗口并显示程序的控制台输出。很可能你不想要那个:)

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

(除非您正在尝试调试应用程序,否则您通常不需要查看它的输出。)

回答by Sachin G.

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.

问题已经回答,更新答案以将 PyCharm bin 目录添加到 $PATH var,以便可以从终端中的任何位置(路径)打开 pycharm 编辑器。

编辑 bashrc 文件,

nano .bashrc

nano .bashrc

在 bashrc 文件末尾添加以下行

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

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

现在你可以在终端的任何地方打开 pycharm

pycharm.sh

pycharm.sh

回答by mrroot5

For Pycharm CE 2018.3and Ubuntu 18.04with snap installation:

对于带有 snap 安装的Pycharm CE 2018.3Ubuntu 18.04

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.

我从 KDE 桌面启动图标得到这个命令。

pychar-ce-command

pychar-ce-命令

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

抱歉语言不通,但我是西班牙开发人员,所以我的系统是西班牙语。

回答by Pooja Khatri

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

首先,转到包含 pycharm.sh 的文件夹并从那里打开终端。然后输入

./pycharm.sh

this will open pycharm.

这将打开pycharm。

bin folder contains pycharm.sh file.

bin 文件夹包含 pycharm.sh 文件。