Last active
May 5, 2020 19:28
-
-
Save paridin/7599f90f0abe55926a5c to your computer and use it in GitHub Desktop.
Simple script for installing python 3.8 on environments *.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) 2015-2019, Roberto Estrada | |
# All rights reserved. | |
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
# First relase 18 Sep 2015 | |
# A simple script who help to install a devel enviroment on nix system, it works without root permissions | |
# dependencies: | |
# RH, Centos, Fedora | |
# yum install bzip2-devel ncurses-devel gdbm-devel sqlite-devel readline-devel xz-devel zlib-devel openssl-devel libxslt-devel libxml2-devel | |
# Debian/Ubuntu | |
# apt install libffi-dev uuid-dev libgdbm-compat-dev libbz2-dev libncurses-dev libgdbm-dev libsqlite3-dev libreadline-dev liblzma-dev zlib1g-dev libssl-dev libxslt1-dev libxml2-dev | |
# updated 7 Oct 2015 - Add BSD License | |
# updated 23 Oct 2019 - Add Version 3.8.0 | |
# updated 29 Apr 2020 - Add list of dependencies and update to 3.8.2 | |
PYTHON_VERSION=3.8.2 | |
INSTALL_DIR=$HOME/.local/tmp; | |
DEVEL_DIR=$HOME/Devel/python; | |
VIRTUAL_DIR=$HOME/.virtualenvs | |
LAST_STABLE_PYTHON=Python-$PYTHON_VERSION.tgz | |
LOCAL_DIR=$HOME/.local | |
mkdir -p $INSTALL_DIR $DEVEL_DIR; | |
cd $INSTALL_DIR; | |
# get last version of python and install it | |
wget https://www.python.org/ftp/python/$PYTHON_VERSION/$LAST_STABLE_PYTHON; | |
tar -xvzf Python-$PYTHON_VERSION.tgz; | |
cd Python-$PYTHON_VERSION; | |
./configure --prefix=$LOCAL_DIR; | |
make; make install; | |
# linking python3 as python for easy control | |
cd $LOCAL_DIR/bin; | |
ln -s python3 python | |
cd -; | |
# setting variables in bash_profile | |
echo "export PATH=$HOME/.local/bin:\$PATH" >> ~/.bash_profile; | |
echo "export VIRTUALENVWRAPPER_PYTHON=$HOME/.local/bin/python" >> ~/.bash_profile; | |
echo "export WORKON_HOME=$VIRTUAL_DIR" >> ~/.bash_profile; | |
echo "export PROJECT_HOME=$DEVEL_DIR" >> ~/.bash_profile; | |
cd -; | |
# cleaning tmps | |
rm -rf $INSTALL_DIR/* | |
source ~/.bash_profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
April 2020