Suddenly, my no-paso broke. I recovered safely, but I skipped the OS and replaced it.
So, this article was popular, so I took this opportunity to introduce poetry. https://qiita.com/sk217/items/43c994640f4843a18dbe
There aren't many introductory articles in the world yet. I didn't find an article to put in from python with the OS blown off, right? ** This time, I will start from pyenv. ** ** Why? This is because poetry does not seem to include python itself, unlike pipenv.
Something like pipenv. I was interested in poetry because I was frustrated by the pipenv error and the lock being too slow. The lock-related thing is a nice pipenv-like thing.
First, for installation
Put in.
sudo apt install python3 git curl
If you insert python as it is, ipython will not work. So, put sqlite3 in advance. Maybe libsqlite3-dev was all I needed ...
sudo apt install sqlite libsqlite3-dev
The python I put in above is a temporary ~~ system python that will endure the world, so I don't use it much. Unlike pipenv, it doesn't include python itself. So put pyenv in it.
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
You can use the pyenv command on the second and subsequent lines.
So, let's put in python for the time being. Restart the shell and the following is fine. Please read version appropriately.
pyenv install 3.8.1
pip re-insco
curl -kL https://bootstrap.pypa.io/get-pip.py | python
Silently below
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
poetry completions bash > /etc/bash_completion.d/poetry.bash-completion
It seems that the second line will be the perfect complement to poetry.
mkdir hoge
cd hoge
poetry init
Somehow, I'm asked a lot of difficult things. For the python version, specify the one installed above. After that, poetry will switch without permission.
It's kind of difficult, so let's have it done more automatically. The following is almost the same as the above (slightly different).
poetry new hoge
It's easy.
Here, I got stuck with a mysterious mistake. For some reason, my poetry project had a .venv directory from the beginning, Installation failed. It seems that it happened during trial and error. It's better not to have strange garbage.
It's quite different from pipenv. Unlike pipenv, which manages everything, python installation itself is done by pyenv, It feels like poetry will switch between libraries and installed python.
The install of pipenv is add. The run and shell remain the same.
poetry add ipython
poetry run ipython
Like this.
The lock was performed overwhelmingly smoothly compared to pipenv, and I liked it. I will use it.
Recommended Posts