一早起来,觉得Eclipse有点太“经典”了,于是找了一个免费的VsCode。

PS:学个python,结果IDE搞了N天,什么时候是个头啊....

VsCode安装

下载地址:https://code.visualstudio.com/

我是用的是Windows x64 Stable版本

VsCode及hello world

配置中文

俺的英文水平比较差,原来用惯了工具还要,换个新工具,自然还是zh_cn比较容易上手。

配置中文显示的方法如下:

1、万能的Ctrl+Shift+P,选择:Configure Display Language

VsCode及hello world

2、安装中文

VsCode及hello world

VsCode及hello world

3、重启VsCode

VsCode及hello world

4、中文来也~~

VsCode及hello world

安装Python扩展

在VsCode的“扩展”中搜索python,然后安装

VsCode及hello world

VsCode及hello world

编译并运行hello world

1、打开预定好的文件夹作为工作目录,我是用的是D:/VsCode/project/python目录,打开后在VsCode中显示的是全大写

VsCode及hello world  VsCode及hello world

2、在PYTHON工作目录中增加hello.py,写好hello world的代码

VsCode及hello world  

VsCode及hello world

3、点击左侧菜单“运行”,然后点击“运行和调试”按钮,在需要增加的配置中选择Python File

VsCode及hello world

4、成功执行

VsCode及hello world

创建launch.json文件

上面的办法虽然运行成功了,但是你会发现每次都要选一下Python File,如果不想每次都选择,就要自己先配置好launch.json,方法如下:

1、还是在左侧菜单“运行”中,这次不点击运行按钮了,直接点击“创建launch.json文件”,随后选择“Python File”,最后保存。

VsCode及hello world

2、随后你会发现launch.json文件保存到了.vscode/launch.json

VsCode及hello world

3、这时你再去运行hello.py就不会让你每次都选择Python File了

VsCode及hello world

THE END

相关文章:

  • 2021-04-04
  • 2021-09-01
  • 2021-05-27
  • 2021-09-21
猜你喜欢
  • 2021-12-21
  • 2022-02-25
  • 2021-12-22
  • 2021-12-26
  • 2021-10-08
  • 2021-10-25
  • 2021-08-28
相关资源
相似解决方案