1
0
Fork 0
ai-doc/src/Python.tex

81 lines
1.4 KiB
TeX

%
% Python.tex
%
% AI Documentation
%
% Copyright (C) 2022, 2023, Jeff Moe
%
% This document is licensed under the Creative Commons Attribution 4.0
% International Public License (CC BY-SA 4.0) by Jeff Moe.
%
\section{Introduction}
There are a million different ways to set up Python.
This is my own way... It uses pyenv to set up ``any'' Python version
and virtualenv for each Python application.
Install deps:
\begin{minted}{sh}
apt install python3-virtualenv python3-pip
\end{minted}
Set up pyenv, perhaps inspect such script:
\begin{minted}{sh}
curl https://pyenv.run | bash
\end{minted}
Add this to \~/.bashrc:
\begin{minted}{sh}
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
\end{minted}
Typical install to use for a Python application, using version 3.10.6
in this example.
\begin{minted}{sh}
pyenv install 3.10.6
pyenv local 3.10.6
virtualenv -p 3.10.6 env
source env/bin/activate
python --version
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
\end{minted}
Exit virtualenv:
\begin{minted}{sh}
deactivate
\end{minted}
Misc pyenv:
\begin{minted}{sh}
pyenv versions
pyenv install --list
pyenv install 3.5
pyenv install 3.6
pyenv install 3.7
pyenv install 3.8
pyenv install 3.9
pyenv install 3.10.12
pyenv install 3.11.4
pyenv install 3.12.0b3
pyenv install 3.12-dev
pyenv install 3.13-dev
pyenv update
\end{minted}