AdSense

網頁

2025/6/15

Windows 11 Python套件管理工具 PDM安裝

在Windows 11安裝Python的套件管理工具PDM的方式如下。


本範例參考官方說明,需要Python 3.9以上版本。


安裝環境

  • Windows 11 Pro
  • Python 3.13.3


安裝

在命令提示字元(cmd)輸入powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py -"開始安裝。

C:\>powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py -"
Installing PDM (latest): Creating virtual environment
Installing PDM (latest): Installing PDM and dependencies
Installing PDM (latest): Making binary at C:\Users\bronx\AppData\Roaming\Python\Scripts
Usage: pdm [-h] [-V] [-c CONFIG] [-v | -q] [--no-cache] [-I] [--pep582 [SHELL]] [-n] ...

    ____  ____  __  ___
   / __ \/ __ \/  |/  /
  / /_/ / / / / /|_/ /
 / ____/ /_/ / /  / /
/_/   /_____/_/  /_/

Options:
  -h, --help            Show this help message and exit.
  -V, --version         Show the version and exit
  -c, --config CONFIG   Specify another config file path [env var: PDM_CONFIG_FILE]
  ...

Successfully installed: PDM (2.25.2) at C:\Users\user\AppData\Roaming\Python\Scripts\pdm.exe
Post-install: c:\users\user\appdata\roaming\python\scripts is added to PATH env, please restart your terminal to take effect

安裝完後會自動添加PATH變數c:\users\user\appdata\roaming\python\scripts即為PDM執行檔pdm.exe的安裝位置。

重新開啟一個新的命命提示字元視窗,執行pdm --version顯示版本確認安裝成功。

C:\>pdm --version
PDM, version 2.25.2

接著參考「Python PDM建立新專案」。


沒有留言:

AdSense