Перейти к содержимому

Как открыть терминал от админа pycharm

  • автор:

Terminal emulator

PyCharm includes an embedded terminal emulator for working with your command-line shell from inside the IDE. Use it to run Git commands, set file permissions, and perform other command-line tasks without switching to a dedicated terminal application.

Enable the Terminal plugin

This functionality relies on the Terminal plugin, which is bundled and enabled in PyCharm by default. If the relevant features aren’t available, make sure that you didn’t disable the plugin.

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. Open the Installed tab, find the Terminal plugin, and select the checkbox next to the plugin name.

Initially, the terminal emulator runs with your default system shell, but it supports many other shells, such as Windows PowerShell, Command Prompt cmd.exe , sh , bash , zsh , csh , and so on. For more information about changing the shell, refer to Terminal settings.

Open the Terminal tool window

  • Go to View | Tool Windows | Terminal or press Alt+F12 .

Right-click a project item in the Project tool window and choose Open in terminal from the context menu. This way the terminal will start with the directory corresponding to the selected item.

You can open the terminal as an editor tab: right-click the Terminal tool window header and select Move to Editor .

Start a new local session

New session in the terminal

  • To start a new session in a separate tab, click on the toolbar or press Control+Shift+T .

To run multiple sessions inside a tab, right-click the tab and select Split Right or Split Down in the context menu.

The Terminal saves tabs and sessions when you close the project or PyCharm. It preserves tab names, the current working directory, and even the shell history.

To close a tab, click on the Terminal toolbar or press Control+F4 .

Press Alt+ArrowRight and Alt+ArrowLeft to switch between active tabs. Alternatively, you can press Alt+ArrowDown to see the list of all terminal tabs.

Configure shortcuts for the terminal actions in the IDE settings ( Control+Alt+S ), under Keymap | Plugins | Terminal .

Start a new SSH session

Start a new SSH session

  1. On the toolbar, click .
  2. Click New SSH Session , enter the address of a host to which you want to connect, and provide authentication data. Or, if you have configured SSH configurations, you can select one of them from the list.

To terminate the connection, click in the terminal tab.

Rename terminal tab

  • Right-click the tab and select Rename Session from the context menu.

Just like with system terminal tabs, you can rename PyCharm Terminal tabs programmatically. For example, use title MyTitle if your interpreter is Windows Command Prompt or echo -en «\033]0;MyTitle\a» for bash and zsh. This feature is available if the Show application title checkbox is selected in Advanced Settings.

Search in terminal

  • To search for a certain string in a Terminal session, press Control+F . This searches all text in the session: the prompt, commands, and output.

By default, the search is not case-sensitive. You can click Match case in the search field to make it case-sensitive.

Configure the terminal emulator

  • Press Control+Alt+S to open the IDE settings and then select Tools | Terminal . For more information, refer to Terminal settings.

For advanced settings, select Advanced Settings and scroll down to the Terminal group. For more information, refer to Advanced Settings: Terminal.

Terminal

WebStorm includes an embedded terminal emulator for working with your command-line shell from inside the IDE. Use it to run Git commands, set file permissions, and perform other command-line tasks without switching to a dedicated terminal application.

Enable the Terminal plugin

This functionality relies on the Terminal plugin, which is bundled and enabled in WebStorm by default. If the relevant features aren’t available, make sure that you didn’t disable the plugin.

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. Open the Installed tab, find the Terminal plugin, and select the checkbox next to the plugin name.

Initially, the terminal emulator runs with your default system shell, but it supports many other shells, such as Windows PowerShell, Command Prompt cmd.exe , sh , bash , zsh , csh , and so on. For more information about changing the shell, refer to Terminal settings.

Open the Terminal tool window

  • Go to View | Tool Windows | Terminal or press Alt+F12 . By default, the terminal emulator runs with the current directory set to the root directory of the current project. For more information about changing the default start directory, refer to Terminal settings.
  • Right-click any file (for example, in the Project tool window or any open editor tab) and select Open in Terminal to open the Terminal tool window with a new session in the directory of that file.

You can open the terminal as an editor tab: right-click the Terminal tool window header and select Move to Editor .

Start a new local session

New session in the terminal

  • To start a new session in a separate tab, click on the toolbar or press Command T .

To run multiple sessions inside a tab, right-click the tab and select Split Right or Split Down in the context menu.

The Terminal saves tabs and sessions when you close the project or WebStorm. It preserves tab names, the current working directory, and even the shell history.

To close a tab, click on the Terminal toolbar or press Control+F4 .

Press Alt+ArrowRight and Alt+ArrowLeft to switch between active tabs. Alternatively, you can press Alt+ArrowDown to see the list of all terminal tabs.

Configure shortcuts for the terminal actions in the IDE settings ( Control+Alt+S ), under Keymap | Plugins | Terminal .

Start a new SSH session

Start a new SSH session

  1. On the toolbar, click .
  2. Click New SSH Session , enter the address of a host to which you want to connect, and provide authentication data. Or, if you have configured SSH configurations, you can select one of them from the list.

To terminate the connection, click in the terminal tab.

Rename terminal tab

  • Right-click the tab and select Rename Session from the context menu.

Just like with system terminal tabs, you can rename WebStorm Terminal tabs programmatically. For example, use title MyTitle if your interpreter is Windows Command Prompt or echo -en «\033]0;MyTitle\a» for bash and zsh. This feature is available if the Show application title checkbox is selected in Advanced Settings.

Search in terminal

  • To search for a certain string in a Terminal session, press Control+F . This searches all text in the session: the prompt, commands, and output.

By default, the search is not case-sensitive. You can click Match case in the search field to make it case-sensitive.

Configure the terminal emulator

  • Press Control+Alt+S to open the IDE settings and then select Tools | Terminal . For more information, refer to Terminal settings.

For advanced settings, select Advanced Settings and scroll down to the Terminal group. For more information, refer to Advanced Settings: Terminal.

Run IDE features from the terminal

Instead of running a specific command in the integrated terminal and reading console output, you can use the relevant IDE feature, like a tool window or a dialog that implements this functionality. For example, you can launch an npm, yarn, gulp, or grunt command from the Terminal tool window and view its output in the Run or Debug tool window.

Run a command in the Run or Debug tool window from the terminal

  1. Type a command ( npm run serve ) in the terminal and notice how it is highlighted. Smart command execution highlighting for npm run serve command in the Terminal
  2. Instead of pressing Enter , which runs the command in the terminal, press Control+Enter to open the corresponding GUI element. In this example, it will open the Run tool window with the output of the npm serve command. Run tool window shows the output of the npm serve commandTo run the command in the Debug tool window, press Control+Shift+Enter .

You can run most of the commands recognized by Run Anything in the Run or Debug tool window.

Run a WebStorm command from the Run Anything popup

  1. Open the Run Anything popup by pressing Control twice.
  2. Start typing a command, for example, npm run serve .
  3. Select the command from the list and press Control+Enter to show its output in the Run tool window or Shift+Enter to show the output in the Debug tool window.

Disable running WebStorm commands from the Terminal

Disable smart command execution from the Terminal tool window

  • Click on the title bar of the Terminal tool window and clear the Run Commands using IDE option.
  • Alternatively, open the Settings dialog ( Control+Alt+S ), go to Tools | Terminal , and clear the Run Commands using IDE checkbox.

Установка и настройка PyCharm в Ubuntu 12.04

PyCharm могу сказать без тени сомнения, что это — самая мощная среда разработки приложений на Python / Django. Поддерживает практически все, что может пригодится Python-программисту, а то, что не поддерживает — компенсируется огромным количеством различных плагинов для этой среды. Почитать, что она умеет, посмотреть скриншоты и видео можно на [urlspan]официальном сайте[/urlspan].

Как установить PyCharm в Ubuntu

Для работы обязательно наличие в системе виртуальной машины Java. Поэтому, первым делом займемся Java’ой. 1. Устанавливаем виртуальную машину Java (если еще не установлена). Примечание: как проверить установлена ли Java? Достаточно набрать в консоли: Если появляется сообщение об отсутствии пакета — значит Java не установлена. По-умолчанию Java не включена в дистрибутив Ubuntu 12.04. Поэтому если у вас свежая только-что-установленная система — то устанавливаем Java по инструкции ниже. Если не свежая или в системе присутствует старая версия Java или OpenJDK, то ее желательно удалить. Удалять пакеты можно с помощью менеджера пакетов (например, Synaptic) или командой:

sudo apt-get purge openjdk-*

Установку Java удобнее всего проводить из стороннего репозитория. Набираем в терминале: — добавляем репозиторий с устновщиком Java

sudo add-apt-repository ppa:webupd8team/java

— обновляем информацию о содержимом репозиториев

sudo apt-get update

— устанавливаем пакет-инсталлятор Java

sudo apt-get install oracle-java8-installer

После установки oracle-java8-installer самостоятельно скачает все необходимые пакеты с серверов Oracle и произведет установку виртуальной машины Java. 2. Скачиваем последнюю версию с [urlspan]официального сайта[/urlspan]. 3. Распаковываем содержимое скачанного архива (.tar.gz) в папку /opt/.
Согласно стандарту [urlspan]FHS[/urlspan], дополнительное программное обеспечение устанавливается в папку/opt/. Будем следовать этому стандарту, поэтому содержимое архива желательно распаковать именно в эту папку.
Как это сделать:
— переносим скачанный архив в папку /opt/.

sudo mv pycharm-2.6.3.tar.gz /opt/

— переходим в папку /opt/.

cd /opt/

— распаковываем архив в текущей папке.

sudo tar -xzvf /opt/pycharm-2.6.3.tar.gz
  • Ключ -x — извлечь файлы из архива (extract)
  • Ключ -z — пропустить архив через gzip
  • Ключ -v — вывести подробный листинг обрабатываемых файлов (verbose)
  • Ключ -f -обработать указанный файл

После распаковки дополнительно можно удалить скачанный архив, дабы не занимал лишнее место:

sudo rm pycharm-2.6.3.tar.gz

Если все прошло без ошибок, то на этом установка завершена.

Как запустить PyCharm

Для запуска в Linux служит скрипт pycharm.sh, который находится в папке /bin/ программы. Сразу после установки программу можно запустить, находясь в папке/opt/pycharm-2.6.3/ (важно) и набрав в терминале:

bin/pycharm.sh

Но каждый раз открывать терминал, заходить в нужную папку и набирать команду, мягко говоря, не удобно. Поэтому лучше один раз создать символическую ссылку на этот файл (своего рода ярлык, только не визуальный):

sudo ln -s /opt/pycharm-2.6.3/bin/pycharm.sh /usr/bin/pycharm

Наличие символической ссылки в /usr/bin/ позволяет запускать нашу IDE простой командойpycharm, набранной в главном меню (Dash) по нажатию Alt+F2 (в Ubuntu 12.04).

Примечание: выполнять в терминале не рекомендуется, поскольку в этом случае он будет зависеть от терминала, в котором больше ничего нельзя будет сделать, а закрытие терминала приведет к закрытию PyCharm.

Если такой вариант вам неудобен, то можно создать ярлык. Как создать ярлык в конкретной системе — зависит от дистрибутива Linux, в одних это сделать легче, в других — чуть сложнее.

Как создать ярлык:
Создаем файл ярлыка pycharm.desktop:

  • Ubuntu: gedit ~/.local/share/applications/pycharm.desktop
  • Linux Mint: gedit ~/Рабочий стол/pycharm.desktop или gedit ~/Desktop/pycharm.desktop — в зависимости от установленного языка

В файле пишем следующий текст и сохраняем:
[Desktop Entry]
Name=PyCharm
Comment=Среда разработки PyCharm
GenericName=PyCharm
Keywords=PyCharm;Python;Django;IDE;
Exec=/usr/bin/pycharm
Terminal=false
Type=Application
Icon=/opt/pycharm-2.6.3/bin/pycharm.png
Categories=
Path=/opt/pycharm-2.6.3/bin/

Примечание: подробное объяснение этих действий находится [urlspan]здесь[/urlspan].

Иногда созданный файл нужно сделать исполняемым (наиболее просто — поставить соответствующие галочки в свойствах файла).

Все. Если у вас Ubuntu, то теперь в главном меню (Dash) по запросу PyCharm будет выводиться созданный ярлык, который при желании можно перетянуть на главную панель. Если у вас Linux Mint, то ярлык сразу появится прямо на рабочем столе.

Читайте другие интересные статьи

Понравилась статья, расскажи о ней друзьям, нажми кнопку!

Не открывается cmd в PyCharm

error

В PyCharm не открывается терминал, PyCharm последней актуальной версии, Windows 10 x64. Пробовал запускать от админа, в настройках проекта путь к проекту правильный, путь к cmd — cmd.exe . Логи

 2021-05-20 16:42:59,700 [ 64314] INFO - erminal.AbstractTerminalRunner - Cannot open Local Terminal java.util.concurrent.ExecutionException: Failed to start [C:\Windows\System32\cmd.exe] in B:\Python\code\bot at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:198) at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:46) at org.jetbrains.plugins.terminal.AbstractTerminalRunner.lambda$openSessionInDirectory$6(AbstractTerminalRunner.java:243) at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20) at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11) at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.io.IOException: Couldn't create PTY at com.pty4j.windows.WinPtyProcess.(WinPtyProcess.java:76) at com.pty4j.windows.WinPtyProcess.(WinPtyProcess.java:50) at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:125) at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:185) . 13 more Caused by: com.pty4j.windows.WinPtyException: Error starting winpty: agent executable does not exist: 'B:\Program Files\JetBrains\PyCharm Community Edition 2021.1.1\lib\pty4j-native\win\x86-64\winpty-agent.exe' at com.pty4j.windows.WinPty.(WinPty.java:89) at com.pty4j.windows.WinPtyProcess.(WinPtyProcess.java:73) 

upd теперь даже после переустановки PyCharm сразу же крашится консоль с ошибкой error starting winpty lost connection to agent , так несколько крашей, после error starting winpty agent executable does not exist , а сам файл winpty-agent.exe удаляется.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *