ebner c622df538b
Build and Publish RPM / build-and-publish (push) Failing after 2s
fix workflow
2025-07-01 16:20:44 +02:00
2025-07-01 16:20:44 +02:00
2025-07-01 16:19:26 +02:00
2025-07-01 16:19:26 +02:00
2025-07-01 16:19:26 +02:00
2025-07-01 16:19:26 +02:00

Overview

https://github.com/pyenv/pyenv

Ideas for RPM packaging: https://github.com/niligulmohar/pyenv-rpm

Development

docker run --platform linux/amd64 -it --rm -v $(pwd):/data --workdir /data  gitea.psi.ch/images/rhel9-developer

rpmbuild -ba pyenv.spec

Installation

https://github.com/pyenv/pyenv

Installing pyenv dependencies (https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with-framework-support-on-os-x):

dnf install gcc make patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel

Install/clone pyenv:


[root@lxdev04 ~]# mkdir /opt/pyenv

[root@lxdev04 ~]#  git clone https://github.com/pyenv/pyenv.git /opt/pyenv
Cloning into '/opt/pyenv'...
remote: Enumerating objects: 24035, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 24035 (delta 42), reused 89 (delta 38), pack-reused 23935
Receiving objects: 100% (24035/24035), 4.91 MiB | 23.30 MiB/s, done.
Resolving deltas: 100% (16199/16199), done.

[root@lxdev04 ~]# ln -s /opt/pyenv/bin/pyenv /usr/bin/pyenv

Create profile script:

[root@lxdev04 bin]# cat /etc/profile.d/pyenv.sh
if [[ ${UID} -ge 1000 && ! ${USER} =~ -adm$ ]]; then
   export PYENV_ROOT="$HOME/.pyenv"
   # export PYENV_ROOT="/tmp/$USER/.pyenv"
   [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
   eval "$(pyenv init -)"
fi

Installation virtualenv plugin (https://github.com/pyenv/pyenv-virtualenv):

git clone https://github.com/pyenv/pyenv-virtualenv.git /opt/pyenv/plugins/pyenv-virtualenv

Use pyenv:

# show installed versions
pyenv versions
# show current python version
pyenv version
# show possible python versions to install
pyenv install --list
# install a python version
pyenv install <versions>

# activate python version for current shell:
pyenv shell <version>

# uninstall python version
pyenv uninstall <version>

# create a python environment
pyenv virtualenv <version> <name>

# activate virtual environment in current shell
pyenv shell <name>

# remove virtualenv
pyenv virtualenv-delete <name>

INFO: Somehow pyenv local does not work (i.e. switching python version based on directory!)

Tutorial: https://realpython.com/intro-to-pyenv

S
Description
No description provided
Readme 36 KiB
Languages
Shell 100%