xuzhengfu / pilot

进入编程世界的第一课
1 stars 0 forks source link

安装 Visual Studio Code #5

Open xuzhengfu opened 4 years ago

xuzhengfu commented 4 years ago

1. 安装 Visual Studio Code

之前已安装完毕。

2. 设置 Visual Studio Code

  1. 在 VSCode 中按 ⌘⇧+P 打开命令窗口,输入 install,从弹出的命令中选择 Shell Command: Install 'code' command in PATH,这样以后我们可以在命令行里用 code 命令来运行 VSCode 并打开指定文件或者文件夹。

  2. 回到 Terminal 窗口,在命令行界面操作:输入 mkdir Code ↩︎ 在用户主目录下创建一个叫 Code 的子目录,以后我们写的代码都可以放在这里;

  3. 输入 cd Code ↩︎ 进入 Code 子目录;输入 code . ↩︎ 这里 code 是运行 VSCode 的命令行命令,后面跟的参数是命令 VSCode 打开的文件或者文件夹,这里我们用一个点 . 代表“当前目录”,所以此命令会运行 VSCode 并打开 Code 这个目录;

  4. 创建一个新文件:在 VSCode 中按 ⌘+N 打开一个新文件,输入 print('Hello world!'),然后按 ⌘+S 保存,文件名为 hello.py

  5. 回到 Terminal 窗口,然后:输入 ls ↩︎,应该可以看到刚才新建的文件 hello.py;输入 python3 hello.py 可以看到运行 hello.py 程序的结果。

python3 hello 运行结果

Reference

  1. 编程环境配置指南
  2. 如何在 issue 中插入截图?#6

Logging

2020-02-03 12:57:40 initialize