简体   繁体   中英

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. It is annoying having to manually type #! /users/w/x/y/z/bin/python #! /users/w/x/y/z/bin/python every time I create a new project. Also would be nice to include certain imports I use 90% of the time.

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 ?

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 apply and OK . After that everytime you open a project, select that template to include default lines you want. You could make number of templates.

单击带有项目名称的右上角选项卡,然后转到“ Edit Configurations ,您可以在其中更改解释器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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