Skip to content

Instantly share code, notes, and snippets.

@datalater
Last active February 7, 2018 01:59
Show Gist options
  • Save datalater/2530d28c48337dac5c3f01c158265e5c to your computer and use it in GitHub Desktop.
Save datalater/2530d28c48337dac5c3f01c158265e5c to your computer and use it in GitHub Desktop.
python-bash-frequently-used-command
# ALL COMMANDS SHOULD BE USED IN BASH
########################
# #
# package version #
# #
########################
# check version for all packages
pip list
# check version for specific package e.g. torch
pip show torch
# update version
pip install -U torch
pip install torch --upgrade
# degrade or install packages of specific version
sudo pip install -U numpy==1.11.0
# uninstall package
pip uninstall torch
########################
# #
# Anaconda #
# #
########################
# list of all environments
conda env list
# create new envrionment named py35 and install python3.5
conda create --name py35 python=3.5
# activate new environment
activate py35 # for windows
source activate py35 # for mac or linux
# delete environment
conda env remove --name bio-env
# install package
conda install tensorflow
########################
# #
# Jupyter notebook #
# #
########################
# kernel list
jpyter kernelspec list
# if you installed python 2 and python 3 in local
# ____________________________________________
# create multi-kernel
python2 -m pip install ipykernel
python2 -m ipykernel install --name py27-test
python3 -m pip install ipykernel
python3 -m ipykernel install --name py36-test
# if you installed python 3 anaconda and want to create python 2 environment
# ____________________________________________
# create virtual environment
conda create -n yourenvname python=x.x anaconda
activate yourenvname
# create multi-kernel
python -m ipykernel install --name yourkernelname
# [NOTE] path of kernel installed just before : C:\ProgramData\jupyter\kernels
# [NOTE] if you want to remove specific kernel, then just remove the folder above
########################
# #
# PyTorch #
# #
########################
# install PyTorch in Windows (ref. http://bob3rdnewbie.tistory.com/313)
conda create -n tc python=3.6
activate tc
conda install -c peterjc123 pytorch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment