[英]Is it possible to include interpreter path (or set any default code) when I create new python file in Pycharm?
I haven't been able to find anything and I am not sure if this is the place I should be asking... 我什么都找不到,我不确定这是否是我要问的地方...
But I want to include the path to my interpreter in every new project I create. 但是我想在我创建的每个新项目中都包括解释器的路径。 The reason being is that I develop locally and sync my files to a linux server.
原因是我在本地开发并将文件同步到linux服务器。 It is annoying having to manually type
#! /users/w/x/y/z/bin/python
不得不手动键入
#! /users/w/x/y/z/bin/python
很烦#! /users/w/x/y/z/bin/python
#! /users/w/x/y/z/bin/python
every time I create a new project. 每次创建新项目时,
#! /users/w/x/y/z/bin/python
Also would be nice to include certain imports I use 90% of the time. 包括我90%的时间使用的某些导入内容也很不错。
I got to thinking, in the program I produce music with you can set a default project file. 我想了一下,在程序中我制作音乐可以设置默认项目文件。 Meaning, when you click new project it is set up how you have configured (include certain virtual instruments, effects, etc).
意思是,当您单击新项目时,将设置您的配置方式(包括某些虚拟乐器,效果等)。
Is it possible to do this or something similar with IDE , and more specifically, Pycharm ? 是否可以执行此操作或使用IDE (或更具体地说,使用Pycharm)执行类似操作 ?
You should open File in the main menu and click Default Settings , collapse the Editor then click File and Code Templates , in the Files tab click on the + sign and create a new Template , give the new template a name and extension, in the editor box put your template content, in your case #! /users/w/x/y/z/bin/python
您应该在主菜单中打开“ 文件 ” ,然后单击“ 默认设置” ,折叠编辑器,然后单击“ 文件和代码模板” ,在“ 文件”选项卡中,单击+号并创建一个新模板 ,并在编辑器中为新模板指定名称和扩展名。框放置您的模板内容,以您的情况
#! /users/w/x/y/z/bin/python
#! /users/w/x/y/z/bin/python
apply and OK . #! /users/w/x/y/z/bin/python
apply并确定 。 After that everytime you open a project, select that template to include default lines you want. 之后,每次打开项目时,都选择该模板以包含所需的默认行。 You could make number of templates.
您可以制作许多模板。
单击带有项目名称的右上角选项卡,然后转到“ Edit Configurations
,您可以在其中更改解释器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.