Poetry is a Python dependency management and packaging tool.It allows you to declare the libraries your project depends on and will manage (install/update) them for you.
Official website:
https://python-poetry.org/
There are three ways to install Poetry:
It is officially recommended to use the official installation script, located at: https://python-poetry.org/docs/.
Note: The get-poetry.py script will be replaced by install-poetry.py in Poetry 1.2, it is recommended to use the latest version of the install script directly.This is done by selecting master in the version selection drop-down box at the top.
The default installation script on the official website is still get-poetry.py, during the installation process I noticed that the prompt message contains the following prompt: This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
It was only then noticed that it was better to choose install-poetry.py.
For Windows operating system, you need to enter under PowerShell
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
poetry can't create a different version of python, conda can
First close poetry globally to create a virtual environment, be careful not to operate in the conda activated environment at this time
Turn off poetry's ability to create a virtual environment
poetry config virtualenvs.create false
Create a new conda virtual environment,
conda create -n myenv python=3.9
Enter it, execute
poetry env info
Make sure you are using the conda virtual environment, you should get results similar to the following
Then use poetry in the myenv environment created by conda, and refer to other people's articles.
VirtualenvPython: 3.8.11Implementation: CPythonPath: /data/user/anaconda3/envs/myenvValid: True
References:
What's wrong with mixing conda and poetry?
Python Development—Building a Virtual Python Development Environment (Conda+Poetry)
Basic use of poetry in Python package management
Python dependency management and packaging tool Poetry installation and testing
The best PythonThe virtual environment Poetry
poetry mixed with conda and vscode, trampled pits and summary
Poetry (2) Basic usage of Poetry