Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Add PowerShell snippet in the installation instructions (web & scripts) to allow Windows users to modify %PATH% easier #66

Open
1 task done
tats-u opened this issue Jun 26, 2022 · 3 comments

Comments

@tats-u
Copy link
Contributor

tats-u commented Jun 26, 2022

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

https://python-poetry.org/docs/master/#installing-with-the-official-installer

Add Poetry to your PATH

The installer creates a poetry wrapper in a well-known, platform-specific directory:

  • $HOME/.local/bin on Unix.
  • %APPDATA%\Python\Scripts on Windows.

If this directory is not present in your $PATH, you can add it in order to invoke Poetry as poetry.

Alternatively, the full path to the poetry binary can always be used:

  • $POETRY_HOME/bin/poetry if $POETRY_HOME is set.
  • ~/Library/Application Support/pypoetry/bin/poetry on MacOS.
  • ~/.local/share/pypoetry/bin/poetry on Linux/Unix.
  • %APPDATA%\pypoetry\Scripts\poetry on Windows.

The following snippet is helpful and should be appended in the document for Windows users:

if (-not (Get-Command poetry -ErrorAction Ignore)) { [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:APPDATA\Python\Scripts", "User") }

or (for PowerShell 6+)

if (-not (Get-Command poetry -ErrorAction Ignore)) { echo 'if (-not (Get-Command poetry -ErrorAction Ignore)) { $env:Path += ";$env:APPDATA\Python\Scripts" }' | Out-File -Append $PROFILE }

P.S. The script provided by https://install.python-poetry.org also needs this fix.

@johnthagen
Copy link
Contributor

Related question:

  • #5917

@tats-u
Copy link
Contributor Author

tats-u commented Jul 10, 2022

@johnthagen I have just installed Poetry to another machine, and I found that your question is also problematic.

@tats-u tats-u changed the title [Doc] Add PowerShell snippet in the installation instruction to allow Windows users to modify %PATH% easier [Doc] Add PowerShell snippet in the installation instructions (web & scripts) to allow Windows users to modify %PATH% easier Jul 10, 2022
@johnthagen
Copy link
Contributor

johnthagen commented Jul 12, 2022

On Linux, a similar snippet is provided in the new installer to help the user add poetry to the PATH:

$ sudo apt install curl python3-venv
$ curl -sSL https://install.python-poetry.org | python3 -
...
Add `export PATH="/home/user/.local/bin:$PATH"` to your shell configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants