Python
General
- Check environment
- Reference: Python, pip, site-packages (Chinese)
$ pip -V $ python -m site
- Reference: Python, pip, site-packages (Chinese)
UV
Installation
- uv-docs-Installation
or
$ brew install uv$ curl -LsSf https://astral.sh/uv/install.sh | less
Conda
Installation
Install Package
$ conda install xxx
$ conda install -c conda-forge xxx
Useful Tools
$ conda install -c conda-forge tmux
Post-installation
$ conda config --set auto_activate_base false
# It creates ~/.condarc with following content:
auto_activate_base: false
Jupyter notebook
$ conda install ipykernel
$ python -m ipykernel install --user --name lal --display-name "python-lal"
# It modifies ~/Library/Jupyter/kernels/ or ~/.local/share/jupyter/kernels/
Conda ENV
$ conda create -n py37 python=3.7
$ conda activate py37
$ conda deactivate
$ conda env list
$ conda env remove -n py37
HTTP server
Star a http server (e.g., for file sharing)
$ python3 -m http.server
Virtual Environment
virtualenv$ virtualenv <myenv> $ source myenv/bin/activate $ deactivatepip$ pip freeze > requirements.txt $ pip install -r requirements.txt