Poetry 安装指南
Linux 系统(如 Ubuntu)
🔹 默认安装步骤
1. 安装 Poetry(默认路径)
curl -sSL https://install.python-poetry.org | python3 -
默认安装路径为:~/.local/share/pypoetry/venv
可执行文件路径为:~/.local/bin/poetry
2. 将 poetry 添加到 PATH
export PATH="$HOME/.local/bin:$PATH"
3. 验证安装
poetry --version
4. 永久生效(直接执行以下命令,写入 shell 配置)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
🔹 指定目录安装步骤
1. 设置自定义安装目录(如 /opt/poetry)
export POETRY_HOME="/opt/poetry"
注意:你需要有写入 /opt/poetry 的权限,可以使用 sudo 或修改目录权限。
2. 安装 Poetry 到指定目录
curl -sSL https://install.python-poetry.org | python3 -
安装路径变为:/opt/poetry/venv
可执行文件路径为:/opt/poetry/bin/poetry
3. 将 poetry 添加到 PATH
export PATH="$POETRY_HOME/bin:$PATH"
4. 设置镜像源(可选)
export POETRY_PYPI_MIRROR="https://pypi.tuna.tsinghua.edu.cn/simple"
5. 永久生效(直接执行以下命令,写入 shell 配置)
echo 'export POETRY_HOME="/opt/poetry"' >> ~/.bashrc
echo 'export PATH="$POETRY_HOME/bin:$PATH"' >> ~/.bashrc
echo 'export POETRY_PYPI_MIRROR="https://pypi.tuna.tsinghua.edu.cn/simple"' >> ~/.bashrc
source ~/.bashrc
————————————————
版权声明:本文为CSDN博主「热爱生活的猴子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/hahaha_1112/article/details/149119217