[Python] 在 Mac 上安裝 pipx 與 cookiecutter

[Python] 在 Mac 上安裝 pipx 與 cookiecutter

cookiecutter 是一個 Python template 產生器,

因為在我們的一個專案有用到,想說要來安裝一下…

 

看了一下說明,它要用 pipx 來安裝,

pipx 可以用 Homebrew 直接裝起來:

brew install pipx

 

有了 pipx,就可以用它來安裝 cookiecutter 了:

pipx install cookiecutter

 

裝好後,cookiecutter 就可以執行囉:

$ cookiecutter

Usage: cookiecutter [OPTIONS] [TEMPLATE] [EXTRA_CONTEXT]...

  Create a project from a Cookiecutter project template (TEMPLATE).

  Cookiecutter is free and open source software, developed and managed by
  volunteers. If you would like to help out or fund the project, please get in
  touch at https://github.com/cookiecutter/cookiecutter.

Options:
  -V, --version                Show the version and exit.
  --no-input                   Do not prompt for parameters and only use
                               cookiecutter.json file content. Defaults to
                               deleting any cached resources and redownloading
                               them. Cannot be combined with the --replay
                               flag.
  -c, --checkout TEXT          branch, tag or commit to checkout after git
                               clone
  --directory TEXT             Directory within repo that holds
                               cookiecutter.json file for advanced
                               repositories with multi templates in it
  -v, --verbose                Print debug information
  --replay                     Do not prompt for parameters and only use
                               information entered previously. Cannot be
                               combined with the --no-input flag or with extra
                               configuration passed.
  --replay-file PATH           Use this file for replay instead of the
                               default.
  -f, --overwrite-if-exists    Overwrite the contents of the output directory
                               if it already exists
  -s, --skip-if-file-exists    Skip the files in the corresponding directories
                               if they already exist
  -o, --output-dir PATH        Where to output the generated project dir into
  --config-file PATH           User configuration file
  --default-config             Do not load a config file. Use the defaults
                               instead
  --debug-file PATH            File to be used as a stream for DEBUG logging
  --accept-hooks [yes|ask|no]  Accept pre/post hooks
  -l, --list-installed         List currently installed templates.
  --keep-project-on-failure    Do not delete project folder on failure
  -h, --help                   Show this message and exit.

 

(本頁面已被瀏覽過 46 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料