简体   繁体   English

使用当前路径从终端打开 Pycharm

[英]Opening Pycharm from terminal with the current path

If you give in the command "atom ."如果您输入命令“atom”。 in the terminal, the Atom editor opens the current folder and I am ready to code.在终端中,Atom 编辑器打开当前文件夹,我可以开始编码了。

I am trying to achieve the same with Pycharm using Ubuntu: get the current directory and open it with Pycharm as a project.我正在尝试使用 Ubuntu 与 Pycharm 实现相同的目标:获取当前目录并使用 Pycharm 作为项目打开它。

Is there way to achieve this by setting a bash alias?有没有办法通过设置 bash 别名来实现这一点?

PyCharm可以通过推出charm的命令行工具(可同时开始使用PyCharm首次安装)。

charm .

这对我有用:

pycharm-community .

This works for me:这对我有用:

alias atom_pycharm='~/pycharm/bin/pycharm.sh .'

Maybe you installed it to a different path, though - locate your pycharm.sh file and modify accordingly.也许你将它安装到了不同的路径 - locate你的pycharm.sh文件并进行相应的修改。

You have the usual bash tricks: if you want to run in the background, append an & , redirect stdout/stderr where you want etc.你有通常的 bash 技巧:如果你想在后台运行,附加一个& ,将 stdout/stderr 重定向到你想要的地方等等。

For me its:对我来说:

pycharm.bat . pycharm.bat 。

but I had to add an Environment Variable first using the path where pycharm.bat is located.但我必须首先使用 pycharm.bat 所在的路径添加一个环境变量。 In my case it was:就我而言,它是:

C:\\Program Files\\JetBrains\\PyCharm Community Edition 2019.3.1\\bin C:\\Program Files\\JetBrains\\PyCharm 社区版 2019.3.1\\bin

(how to add an Environment Variable) Windows https://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/ (如何添加环境变量)Windows https://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/

Ubuntu https://hackprogramming.com/2-ways-to-permanently-set-path-variable-in-ubuntu/ Ubuntu https://hackprogramming.com/2-ways-to-permanently-set-path-variable-in-ubuntu/

I'm using Pycharm Community Edition 2019.3.1 and for the life of me I couldn't find the "Command line launcher" everyone else is talking about so I had to resort to this method.我正在使用 Pycharm 社区版 2019.3.1,在我的一生中,我找不到其他人都在谈论的“命令行启动器”,所以我不得不求助于这种方法。

This was for Windows but hopefully it will give you some insight on figuring it out on Ubuntu!这是针对 Windows 的,但希望它会给你一些关于在 Ubuntu 上解决它的见解!

open -na "PyCharm CE.app" . 

在 MacOS 和 PyCharm 社区版中为我工作

enter image description here在此处输入图片说明

Open your terminal and type:$ cd Desktop/pycharm-community打开你的终端并输入:$ cd Desktop/pycharm-community

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM