Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lee-pai-long/c131ea02d5ab84f08a6ddaa4b3c0ee1a to your computer and use it in GitHub Desktop.
Save lee-pai-long/c131ea02d5ab84f08a6ddaa4b3c0ee1a to your computer and use it in GitHub Desktop.
Kivy Installation script Linux Mint
#!/bin/bash
# Set path variables
DIR=`pwd`
SYS_PACKAGES=/usr/local/lib/python2.7/dist-packages
VENV_PACKAGES=$DIR/Venv-Linux/lib/python2.7/site-packages
# Install all kivy dependencies via Apt.
sudo apt-get install -y python2.7 python-setuptools python-pip python-pygame python-opengl \
python-gst0.10 python-enchant gstreamer0.10-plugins-good python-dev build-essential \
libgl1-mesa-dev libgles2-mesa-dev zlib1g-dev
# Install kivy dependencies via Pip.
sudo pip install cython
sudo pip install numpy
sudo pip install pyenchant
sudo pip install Pygments
sudo pip install buildozer
sudo pip install plyer
# Add Kivy's PPA for stable builds and then install kivy.
if [ -f /etc/apt/sources.list.d/kivy-team-kivy-trusty.list ]; then
echo "Kivy PPA already added. Testing of Kivy is installed."
sudo apt-get install python-kivy
else
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get install python-kivy
fi
# Lastly install virtualenv via pip.
sudo pip install virtualenv
# Check if directory "Venv-Linux" exists. If it doesn't, a new virtual
# environment is created in that directory. -Linux is attached to the end
# for projects worked on from multiple environments.
if [ -f Venv-Linux/bin/python ]; then
echo "Virtual Environment already installed!"
else
virtualenv Venv-Linux
fi
# For kivy to work inside the virtual environment, some system packages have to be linked.
ln -s $SYS_PACKAGES/buildozer $VENV_PACKAGES
ln -s $SYS_PACKAGES/Cython $VENV_PACKAGES
ln -s $SYS_PACKAGES/garden $VENV_PACKAGES
ln -s $SYS_PACKAGES/kivy $VENV_PACKAGES
ln -s $SYS_PACKAGES/plyer $VENV_PACKAGES
ln -s $SYS_PACKAGES/pyenchant-1.6.5-py2.7.egg $VENV_PACKAGES
ln -s $SYS_PACKAGES/pygame $VENV_PACKAGES
# # The next few lines makes the script useful cross-project for multiple users.
# # If your project is using specific packages that aren't linked above, provide a
# # requirements.txt file in the root project directory and pipe your dependencies
# # into that file.
# # Switch to virtual environment shell.
# source Venv-Linux/bin/activate
# # Installs any environment specific packages you may need.
# sudo pip install -Ur $DIR/requirements.txt
# deactivate
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment