Forem

Fabrício
Fabrício

Posted on

3 1

O que é o pyenv ?

O pyenv é um gerenciador de versões do python, com ele é possivel utilizar diversas versões do interpretador.

A grande vantagem de se usar o pyenv, é a facilidade de criar ambientes rapidamente.

Veja abaixo como instalar e utilizar o pyenv.

Instalação:

Todos os comandos abaixo estão disponiveis no repositório oficial, que pode ser acessado aqui.aqui

Como sugere a documentação do pyenv, é necessário a instalação de algumas dependências:

sudo apt-get update

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git
Enter fullscreen mode Exit fullscreen mode

Instalar o pyenv:

curl https://pyenv.run | bash
Enter fullscreen mode Exit fullscreen mode

Configurar as variaveis de ambiente

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Enter fullscreen mode Exit fullscreen mode

Reinicia o terminal

exec $SHELL 
Enter fullscreen mode Exit fullscreen mode

Usando o pyenv

Verifique a versão que seu sistema operacional está utilizando:

python -V
Enter fullscreen mode Exit fullscreen mode

Image description

Para procurar uma versão especifica é necessário apenas digitar o comando abaixo:

pyenv install -l
Enter fullscreen mode Exit fullscreen mode

Após escolher a versão é preciso instalar, com o comando:

pyenv install <versão-escolhida-aqui-EX: '3.9.7'>
Enter fullscreen mode Exit fullscreen mode

Para listar as todas as versões que foram instaladas na sua máquina, digite:

pyenv versions
Enter fullscreen mode Exit fullscreen mode

Image description

Para definir a versão nova em seu sistema operacional, o comando “pyenv global” seguido da versão:

pyenv global 3.9.7
Enter fullscreen mode Exit fullscreen mode

Para desinstalar uma versão especifica o comando “pyenv uninstall” seguindo da versão:

pyenv uninstall 3.9.7
Enter fullscreen mode Exit fullscreen mode

Este foi um breve tutorial sobre pyenv, que pode ser muito útil, quando se esta trabalhando varios projetos com versões diferentes.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay