Python environment setup
Conda
# Creating environments
conda create -n <env-name> python=3.0
# To add packages while creating an environment, specify them after the environment name
conda create -n myenvironment python numpy pandas
# Listing environments
conda info --envs
# remote an environment
conda remove -n ENV_NAME --all
# Installing packages
## via environment activation
conda activate myenvironment
conda install matplotlib
## via command line option
conda install --name myenvironment matplotlib
# update package
conda update package_name
pip install --upgrade package_name
## version
conda --version
Jupyter
conda create -n my-conda-env # creates new virtual env
conda activate my-conda-env # activate environment in terminal
conda install jupyter # install jupyter + notebook
jupyter notebook # start server + kernel inside my-conda-env
version: 3.6
services:
jupyter_notebook:
build:
context: jupyter-notebook/
args:
TAG_VERSION: x86_64-ubuntu-22.04
container_name: jupyter_notebook
user: root
command: start-notebook.py --NotebookApp.token=$JUPYTER_TOKEN
volumes:
- /mnt/ssd/jupyter/notebook:/home/jean
environment:
- JUPYTER_TOKEN=$JUPYTER_TOKEN
- NB_USER=jean
- NB_UID=1000
- NB_GID=100
- CHOWN_HOME=yes
working_dir: /home/jean
ports:
- 10088:8888
ARG TAG_VERSION
FROM quay.io/jupyter/base-notebook:${TAG_VERSION}
RUN pip install --no-cache-dir matplotlib numpy pandas
early version installtion on mac
curl -OL http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz
tar xzvf Python-2.6.7.tgz
cd Python-2.6.7
./configure --prefix=/usr/local --enable-shared
make
make install
early version install on kali linux
cd /opt
sudo wget https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
sudo tar -xf Python-2.6.6.tgz -C .
cd Python-2.6.6
sudo ./configure --enable-optimizations
sudo make altinstall
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python2.6 1
python --version
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
update-alternatives --list python
update-alternatives --list python3