Previous Post | Top | Next Post |
TOC
Python virtual environment
I finally get to use python virtual environment using venv
module to be
created under ~/.venv/
. (I wanted to upload a package to pypi.org)
$ apt install python3-pip twine
...
$ python3 -m venv ~/.venv
$ source ~/.venv/bin/activate
(.venv) $ install --upgrade pip
...
(.venv) $ install --upgrade twine
...
(.venv) $ deactivate
System packages were current enough to cause printing
Found existing installation: pip 23.0.1
,
etc. and no new packages were installed in ~/.venv
.
Anyway, I now know how to activate and deactivate python virtual environment.
My motivation to use venv
was to get the latest twine
for pypi.org upload.
It turned out that the system twine
was new enough for pypi.org.
Helper
I added followings to my ~/.bashrc
for the moment:
# create python venv @ $1
venv-create () {
python3 -m venv $1
}
# activate python venv @ $1
venv-activate() {
source $1/bin/activate
}
# update python venv
venv-update () {
pip list --outdated |tail -n +3|cut -d ' ' -f 1|xargs -n1 pip install -U
}
Let me see if they are useful.
Previous Post | Top | Next Post |