Skip to content

Instantly share code, notes, and snippets.

@alvinwan
Last active October 22, 2021 06:10
Show Gist options
  • Save alvinwan/b332a350e1d7f2ee65b78df1e2f56bcd to your computer and use it in GitHub Desktop.
Save alvinwan/b332a350e1d7f2ee65b78df1e2f56bcd to your computer and use it in GitHub Desktop.
.bash_profile
# Use this ~/.bash_profile script on your Glitch instance.
#
# Hello! This file isn't necessary to look at. All you need to know
# is that:
#
# 1. You can create Python files on the left "New File" and use
# `numpy` or `opencv-python` freely.
# 2. On the bottom left, click on "Tools > Terminal" to open terminal
# and run `python <script>` just as you would normally on your
# own computer.
#
# I've included explanations of what's going on, below, in case
# you're really *that curious!
# Install all packages to the /tmp directory, to avoid counting
# temporary files, like pip-installed packages, towards your
# 200 MB limit for glitch projects.
pip3.7 install --no-cache-dir --prefix=/tmp opencv-python
# Point your python path to your unconventional installation path.
export PYTHONPATH=/tmp/lib/python3.7/site-packages
# Alias python (by default python2.7) to the latest Python available
# on Glitch as of time of writing. Also `refresh` (a custom Glitch
# command for refreshing the editor and file browser with disk
# contents), so that you can see any files you may write to disk.
function python() {
python3.7 $@ && refresh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment