brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.config/zsh/env.sh
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.config/zsh/env.sh
echo 'eval "$(pyenv init -)"' >> ~/.config/zsh/env.sh
source ~/.zshrc
pyenv install --list
pyenv install 3.12.2
pyenv global 3.12.2
pyenv rehashbrew install python- Upgrade dependencies after install
python3 -m pip install --upgrade pip setuptools wheel
python3 --versionpython --version
-
Prerequisite
xcode-select --installxcode-select -p(optional)
-
Setup project
python -m venv MyProject- Installsource MyProject/bin/activate- Activate environmentcd MyProjectpip install <package_name>- Install packagesflake8- Linting packageblack- Formatting package
deactivate- Deactivate environmentpip freeze > requirements.txt- Create requirements.txtpip install -r requirements.txt- Install packages in requirements.txt file
-
My Sample project - https://github.com/shaunthomas999/Python_Playground/
-
Reference template - https://github.com/ltsaprounis/python-project-template/
- See
setup.pyfile - Package inside it are installed using command
pip install -e .(development dependencies)
- See
-
References