# 18. 以原始碼在 Windows 上安裝

It is recommended that most users download the binary distribution for Windows, available as a graphical installer package from the PostgreSQL website at <https://www.postgresql.org/download/>. Building from source is only intended for people developing PostgreSQL or extensions.

There are several different ways of building PostgreSQL on Windows. The simplest way to build with Microsoft tools is to install Visual Studio 2022 and use the included compiler. It is also possible to build with the full Microsoft Visual C++ 2013 to 2022. In some cases that requires the installation of the Windows SDK in addition to the compiler.

It is also possible to build PostgreSQL using the GNU compiler tools provided by MinGW, or using Cygwin for older versions of Windows.

使用 MinGW 或 Cygwin 的話，請以標準方式建置系統，參閱[第 17 章](/15/server-administration/installation-from-source-code.md)[第 17.7.4 節](https://docs.postgresql.tw/15/server-administration/pages/-LAGRest90_VA8P2j2hz#17.7.4.-mingw-native-windows)和[第 17.7.2 節](https://docs.postgresql.tw/15/server-administration/pages/-LAGRest90_VA8P2j2hz#17.7.2.-cygwin)的特定說明。 要在這些環境中產生原生 64 位元的編輯執行檔，請使用 MinGW-w64 的工具。 這些工具還可用於在其他主機（例如 Linux 和 macOS）上交叉編譯 32 位元和 64 位元 Windows 標的。 但不建議將 Cygwin 用於運作正式線上伺服器，它應該只用於在無法建置的舊版本 Windows 上。 官方預編譯安裝套件是使用 Visual Studio 編譯的。

Native builds of psql don't support command line editing. The Cygwin build does support command line editing, so it should be used where psql is needed for interactive use on Windows.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/15/server-administration/installation-from-source-code-on-windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
