Python 2 - Install Anaconda on Ubuntu

By Sheldon L Published at 2019-09-18 Updated at 2019-09-18


Installation

# Download
cd ~/Downloads
wget <$link>    # past the download link
bash <$package_name>
# All 'yes' and done

vim ~/.bashrc
# check if there's somthing like: `export PATH=~/anaconda3/bin:$PATH`
source ~/.bashrc

# Check anaconda
anaconda-navigator

# Check Python3
python

# Check Conda
conda --version
# do not auto activate base environment
conda config --set auto_activate_base False
# OR auto activate base environment
conda config --set auto_activate_base True
# if use proxy, OR skip
export all_proxy="" # turn off proxy

# under base env
conda update conda      # update conda
conda update anaconda   # will remove packages which are already installed and install whole new version
conda update --all      # will update the packages that are already installed

Uninstall and Reinstall

# NOTE! always keep `requirments.txt` and `log.txt` in projects
pip freeze -> requirements.txt

# uninstall
rm -rf anaconda3

# remove anacondas setting
sudo gedit ~/.bashrc

# reinstall like above

# recreate envs for projects by using `requirments.txt` and `log.txt`
pip install -r requirements.txt

Start

# Each project should work in an independent virtual environment
conda search "^python$"   # search a python distribution
conda create --name my_env python=3.?  # select a python distribution

source activate my_env

python --version    # check python version
conda info --envs   # check envs list

# if use proxy, pysocks is in need
export all_proxy=""
pip install pysocks

# turn on proxy again
export all_proxy=socks5://127.0.0.1:1080  # replace with your own protocol and port

# if want to remove an env
conda remove --name my_env --all

How to Scrap a Website with Anaconda Scrapy

Web Scraping in Python using Scrapy (with multiple examples)