Learning TinyDB on Ubuntu - 02 poetry

131 阅读1分钟

Introduction

Poetry is a tool helps you manage the project dependencies, virtual environments, and package distribution. Therefore, it is recommended to be used in large or complex python projects with multiple environments.

Installation

To create a venv with conda and source python to pycharm (the path to python is /path/to/anaconda3/envs/venv_name/bin/python)

conda activate venv_name
pip install poetry

If the pip says timeout, we can set the default-timeout longer by

pip install poetry --default-timeout=600

```
with this command pip install will wait at most 600 seconds

Or if you create a venv with pycharm, we can enter the venv with

source /path/to/venv/bin/activate

At this time, if you are also in a conda venv, you will see the terminal show (pycharm_venv)(conda_venv), check to route to pip by

which pip

to ensure you are in the pycharm venv. But it is not recommended, you can just create a conda venv with pycharm.

Update Packages with Poetry

poetry install

Then poetry will update your packages to the edition the project use.