[小技巧] python version control using pyenv or virtualenv

date
Mar 1, 2024
slug
tip-python-version-control
status
Published
summary
小技巧
tags
tip
type
Post
URL

Problem & Summary

pyenv - https://www.janmeppe.com/blog/how-to-set-python3-as-default-mac/

brew install pyenv

# check
pyenv -v

# install python
pyenv install 3.9.0
# set to use 
pyenv global 3.9.0
# should see new version
pyenv version

# put this to .zshrc
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

using virtualenv

# in your current working dir
virtualenv --python=python3.10 .venv
source .venv/bin/activate

Solution

    Screenshots

     

    © Ying Bun 2021 - 2024