Poetry download and install (20230221 latest method)

To quote the official introduction:

Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Poetry offers a lockfile to ensure repeatable installs, and can build your project for distribution.

Translation: Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and will manage (install/update) them for you. Poetry provides a lock file to ensure repeatable installs and build projects for distribution.

Official Poetry Installation Instructions

1. Download and install

At the beginning of the installation, I read various posts on the Internet, but the installation was not successful, and I kept reporting 404: Not Found. If this is the case, then congratulations, the installation is wrong.

After seeing this article ( https://www.cnblogs.com/tugeler/p/16857124.html ), I found out that the official installation address has been changed, please see:

Linux, macOS, Windows (WSL)

curl -sSL https://install.python-poetry.org | python3 -

Windows (Powershell)

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

The official also made installation and replacement instructions, and suggested deleting the previous version:

 After the download is successful, the display is as follows:

After the download is successful, it will prompt the download path of Poetry. The above is an example of ubuntu, and prompts the need to configure environment variables and other operations.

ps: The installation path can be changed by yourself, and the time issue will not be repeated (laziness and cooking are the original sin), and the official website will explain it.

2. Configure environment variables

Enter the environment configuration file, you may be prompted "Command 'vim' not found, but can be installed with:", because the system defaults to only vi, without vim, just install it.

vim ~/.bashrc

Add the following statement (press i for text insertion) at the end, and save and exit (:wq).

export PATH="/home/scenery-ubuntu/.local/bin:$PATH"

Finally, enter the following statement in the terminal to run the script in the .bashrc file to take effect immediately.

source ~/.bashrc

Verify that the installation was successful

poetry --version

As shown in the figure, the installation is successful!

Add a hole: When installing Poetry, according to the official statement, you need to ensure that your python version is 3.7 or above, which is very important!

Poetry requires Python 3.7+. It is multi-platform and the goal is to make it work equally well on Linux, macOS and Windows.(官方提示)

Guess you like

Origin blog.csdn.net/weixin_43422210/article/details/129149703