Skip to content

Python

General

UV

Installation

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
    $ deactivate
    
  • pip
    $ pip freeze > requirements.txt
    $ pip install -r requirements.txt