Published on

Useful stuff in python

Authors
  • avatar
    Name
    Loc Truong
    Twitter

Downloading data from a shared google drive link in google colab

!pip uninstall gdown -y && pip install gdown
!gdown -V
# Method 1:
## for whole shared folders/directories:
!gdown --folder https://drive.google.com/drive/folders/sdsldkfj...somefileid.. -O /some_parent_directory/some_child_directory
## for files
!gdown https://drive.google.com/drive/folders/sdsldkfj...somefileid.. -O /some_parent_directory/some_child_directory
# Method 2: Using down via importing
import gdown
url = 'https://drive.google.com/uc?id=0B9P1L--7Wd2vNm9zMTJWOGxobkU'
output = '20150428_collected_images.tgz'
gdown.download(url, output, quiet=False)

Download python version 3.9

sudo apt install python3.9 python3.9-venv python3.9-dev

If there is error "Couldn't find any package by glob 'python3.9'"

apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa

Set up env

mkdir venv
which python3.9
/usr/bin/python3.9 -m venv venv/
source venv/bin/activate