繁体   English   中英

使用 Windows WSL 安装 Poetry 不起作用,忽略 $HOME

[英]Poetry installation with Windows WSL not working, ignoring $HOME

我有一个 WSL 实例 Ubuntu 20.04,我创建了另一个 Ubuntu 18.04 WSL 实例。

我在 20.04 上安装了 Poetry,没有问题。

我正在尝试使用curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -在 Ubuntu 18.04 实例上安装 Poetry curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -命令。

目前,我的 $HOME env var 指向/home/fromzeroedu

但是,安装后,Poetry 安装在我的 Windows 用户家中:

$ which poetry
/mnt/c/Users/j/.poetry/bin/poetry

如果我尝试获取版本,我会得到:

$ poetry --version
/usr/bin/env: ‘python\r’: Permission denied

我什至尝试在安装之前设置POETRY_HOME

export POETRY_HOME=/home/fromzeroedu/.poetry/bin/poetry

但是 Poetry 仍然安装在 Windows 用户目录中。

有时我喜欢诗歌...

经过多次调试,对于寻找答案的人,我建议这样做:

  • 如果您看到此问题,请卸载并重新安装 WSL。
  • 从您的 Windows 端卸载 Poetry,在管理员模式下启动 Powershell 并执行(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --uninstall (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --uninstall如果您使用get-poetry路线安装。 否则,请执行pip uninstall poetry
  • 安装 WSL,然后通过输入poetry确保不再安装poetry
  • 还要在 Windows 端通过键入poetry检查是否未安装 Poetry
  • 在 Windows 上使用 pip 安装 Poetry: pip install poetry 通过输入poetry检查它是否有效。
  • 在 WSL 上使用get-poetry路线安装。 例如,在 Ubuntu 上,执行curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - . 检查诗歌是通过键入安装的: poetry

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM