sh Ubuntu 14.04.2上的Python 2.7.9(不覆盖原始版本)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Ubuntu 14.04.2上的Python 2.7.9(不覆盖原始版本)相关的知识,希望对你有一定的参考价值。

#! /usr/bin/env bash

# http://smirnov-am.blogspot.com/2015/04/installation-of-python-279-in-ubuntu.html
# http://davebehnke.com/python-pyenv-ubuntu.html
# https://renoirboulanger.com/blog/2015/04/upgrade-python-2-7-9-ubuntu-14-04-lts-making-deb-package/

# install dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
sudo apt-get install checkinstall

# download and extract python 2.7.9 source
mkdir ~/source
cd ~/source
wget http://python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -xvf Python-2.7.9.tgz
sudo mv Python-2.7.9 python-current
#cd Python-2.7.9
cd python-current

# compile python source to new directory
sudo mkdir /opt/python-current
./configure --prefix=/opt/python-current
make

# use checkinstall to create and install deb package
sudo checkinstall --pkgname python-current

# display python version
/opt/python-current/bin/python -V

# install setuptools
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo /opt/python-current/bin/python

# use setuptools to install pip
sudo /opt/python-current/bin/easy_install -s /opt/python-current/bin -d /opt/python-current/lib/python2.7/site-packages/ pip

# update PATH to include the new version of python first
export PATH="/opt/python-current/bin:$PATH"

# package can then be removed with:
# sudo dpkg -r python-2.7.9

以上是关于sh Ubuntu 14.04.2上的Python 2.7.9(不覆盖原始版本)的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 上的 Python 2.6 导入包 (psyco)

Ubuntu 14.04.2 Laravel 4.2.0 PDOException 找不到驱动程序 MySQL

Ubuntu 14.04.2 + Vmware搭建Linux驱动开发环境

sh Ubuntu:清理Ubuntu上的启动分区

sh [ConoHa上的Ubuntu上的Docker] aa

Ubuntu 14.04.2 Laravel 4.2.0 PDOException找不到驱动程序MySQL