Windows端安装perry.ts

2026年5月20日

看大家宣传的还不错, 装起来试试看

  1. 官网 Perry --- TypeScript → Native

  2. 管理员打开终端(win11, 右键开始按钮, 选择终端管理员

  3. 执行安装命令

复制代码
winget install PerryTS.Perry
  1. 安装过程中, 会一起安装 LLVM, xwin, 你也可以通过其他网站下载后安装,

然后重新执行上边的命令, 如果已经检测到安装过了, 会跳过的,

所以安装时记得允许把可执行文件添加到环境变量中

虽然是从github安装, 但是没有FQ也可以下载安装, 软件很大, 记得要有管理员权限

如果下载成功安装失败, 可以查一下winget命令下载的软件在哪里, 然后找到双击安装

复制代码
Windows Toolchain Setup

  This downloads the Microsoft CRT + Windows SDK libraries (via xwin)
  so Perry can link Windows executables without Visual Studio Build Tools.

  ✓ LLVM found: clang
  ✓ xwin found: C:\Users\95486\AppData\Local\Microsoft\WinGet\Packages\PerryTS.Perry_Microsoft.Winget.Source_8wekyb3d8bbwe\xwin.exe
  1. 这俩软件安装完毕后执行初始化命令
复制代码
perry setup windows

这一步同样会检查之前的两个软件是否已经正常安装, 然后安装一些sdk类的东西

复制代码
⚠ Microsoft Visual Studio Build Tools License

  The Microsoft CRT + Windows SDK libraries are redistributable under
  the Microsoft Software License Terms. By proceeding you accept:

    https://go.microsoft.com/fwlink/?LinkId=2086102

  Do you accept the license? yes

  Output: C:\Users\95486\AppData\Local\perry\windows-sdk
  Expect ~700 MB download / ~1.5 GB unpacked. Takes 2–4 minutes on a
  typical connection. Partial downloads are resumable --- safe to re-run.

  CRT.headers [0s] █████████████████████████████████████████████████████████████████████ 14.13 MiB/14.13 MiB 📦 splatted
  CRT.libs.x86_64.desktop [0s] ███████████████████████████████████████████████████████ 204.95 MiB/204.95 MiB 📦 splatted
  CRT.libs.x86_64.store [0s] ███████████████████████████████████████████████████████████ 89.74 MiB/89.74 MiB 📦 splatted
  SDK.headers.all.none [1s] ████████████████████████████████████████████████████████████ 84.53 MiB/84.53 MiB 📦 splatted
  SDK.headers.all.none [0s] ██████████████████████████████████████████████████████████████ 6.21 MiB/6.21 MiB 📦 splatted
  SDK.headers.all.store [2s] █████████████████████████████████████████████████████████ 247.40 MiB/247.40 MiB 📦 splatted
  SDK.headers.all.store [0s] █████████████████████████████████████████████████████████████ 5.24 MiB/5.24 MiB 📦 splatted
  SDK.headers.x86_64.none [0s] ███████████████████████████████████████████████████████ 163.65 KiB/163.65 KiB 📦 splatted
  SDK.libs.x86_64 [0s] █████████████████████████████████████████████████████████████████ 67.02 MiB/67.02 MiB 📦 splatted
  SDK.libs.store.all [0s] ██████████████████████████████████████████████████████████████ 38.05 MiB/38.05 MiB 📦 splatted
  SDK.ucrt.all [0s] ██████████████████████████████████████████████████████████████████ 121.88 MiB/121.88 MiB 📦 splatted
  ✓ Windows SDK ready at C:\Users\95486\AppData\Local\perry\windows-sdk
    (45.4s)

  Try it:  perry compile hello.ts && ./hello.exe
  1. 以上安装结束后就可以试试了, 命令行进入到代码目录, 执行编译链接命令

测试代码文档: Introduction - Perry Documentation

复制代码
PS D:\code\perryproject> perry compile hello.ts -o hello.exe
Collecting modules...
Found 1 module(s): 1 native, 0 JavaScript
Generating code...
Wrote object file: hello_ts.o
Linking (runtime-only)...
Wrote executable: hello.exe
Binary size: 1.2MB
  1. 编译后代码目录文件
  1. 命令行启动程序(没有界面, 所以是命令行直接输出)
复制代码
PS D:\code\perryproject> ./hello.exe
Hello, Perry!
  1. 搞个界面的