Upgrade to Python 2.7.9 on Ubuntu 14.04 LTS
来源:互联网 发布:批发衣服的软件 编辑:程序博客网 时间:2024/06/03 14:36
Upgrade to Python 2.7.9 on Ubuntu 14.04 LTS, and make your own .deb package for deployment
Need to run your web app with Python 2.7.9, but server environment uses Ubuntu 14.04 LTS? Don’t replace Python, leverage VirtualEnv instead!
April 5, 2015I had this post hanging in my drafts on how I attempted to install a valid Python 2.7.9 runtime environment on Ubuntu 14.04 and make my own .deb package for easy re-deployment.
IMPORTANT This procedure isn’t complete as I had to shift focus elsewhere. I might rework this article to adjust what’s missing.
While I understand that Ubuntu 14.04 will remain using Python 2.7.6 internally, applications we run can be configured to use another python environment. Its what virtualenv is all about after all, isn’t it.
This post attempts to install, and make an installable .deb package of Python 2.7.9 and is meant to be used by web applications without touching the system’s python runtime.
Why not replacing internal Python version?
The reason is simple. If you replace internal Python version, other softwares within the OS will have broken dependencies.
I realized this while I wanted to upgrade the version and breaking an hard dependency I have on Salt Stack. Since many components within a given Ubuntu version relies on Python, it could break anything else. This is why I stopped working on the idea of replacing internally, but instead to configure VirtualEnv to use another version instead.
If you see procedures that shows you to replace telling you to use update-alternatives
to replace python, don’t do it! Go instead learn how to run your own Python version in VirtualEnv.
Procedure
Install build dependencies
Those were the ones I ran last before a successful build on Ubuntu 14.04 LTS, if you aren’t using the same distribution, you might get a different list.
apt-get install -y gcc-multilib g++-multilib libffi-dev libffi6 libffi6-dbg python-crypto python-mox3 python-pil python-ply libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libgdbm-dev dpkg-dev quilt autotools-dev libreadline-dev libtinfo-dev libncursesw5-dev tk-dev blt-dev libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libsqlite3-dev libgpm2 mime-support netbase net-tools bzip2
Get Python sources and compile
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgztar xfz Python-2.7.9.tgzcd Python-2.7.9/./configure --prefix /usr/local/lib/python2.7.9 --enable-ipv6makemake install
Test if the version works
/usr/local/lib/python2.7.9/bin/python -VPython 2.7.9
Then prepare package through FPM
apt-get install -y ruby-dev gccgem install fpm...
Its basically about creating a .deb based on your new runtime setup. You can do that by using fpm(“Fabulous Package Manager”), I am using this technique in a post I published recently about installing a PHP library.
Incomplete scratchpad
But that’s as far as my notes goes for now. Sorry about that.
Setuptools
As per recommended in Setuptools instructions, we can run easy_install
through a wget
, like so;
wget https://bootstrap.pypa.io/ez_setup.py -O - | /usr/local/lib/python2.7.9/bin/python /usr/local/lib/python2.7.9/bin/easy_install pip /usr/local/lib/python2.7.9/bin/pip install virtualenv
Then, create symbolic links
ln -s /usr/local/lib/python2.7.9/bin/easy_install /usr/bin/easy_install ln -s /usr/local/lib/python2.7.9/bin/pip /usr/bin/pip
You can try if it worked
pip list pip (6.0.8) setuptools (14.3) virtualenv (12.0.7)
- Upgrade to Python 2.7.9 on Ubuntu 14.04 LTS
- How To Upgrade to Ubuntu 16.04 LTS
- []How To Upgrade to PHP 7 on Ubuntu 14.04
- How to Install Docker on Ubuntu 14.04 LTS
- How to Install Docker on Ubuntu 14.04 LTS
- How to Install Docker on Ubuntu 14.04 LTS
- Upgrade from Ubuntu 14.04. to Ubuntu 16.04 on Desktop and Server Editions
- Upgrade git to be 1.7.2 or higher on ubuntu
- Upgrade from 12.04 LTS to 12.10
- Install CUDA 6.5 on Ubuntu 14.04 LTS
- Install CUDA 6.0 on Ubuntu 14.04 LTS
- Install Nginx on Ubuntu 14.04 LTS
- How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 14.04 LTS
- How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS
- How to Install OpenERP Odoo 8 on Ubuntu Server 14.04 LTS
- Update ubuntu 13.10 to ubuntu 14.04 LTS
- How to install OpenERP 7.0 on Ubuntu 12.04 LTS
- How to Install Ruby on Rails on Ubuntu 12.04 LTS (Precise Pangolin) with RVM
- Precision和Length对MySQL执行结果的影响
- RCTF crypto100(1)
- 我跳槽是因为他们的显示器更大
- 高斯模糊的实现
- android 微信分享
- Upgrade to Python 2.7.9 on Ubuntu 14.04 LTS
- 为什么我们要用struts2,springMVC,spring
- ab和jmeter进行GET/POST压力测试的使用心得和比较
- 对独立变量的X+Y形式分布的小小探索
- ios学习笔记(五)数组和字典
- 每天一点matlab——图像与图形的区别
- JavaScript中confirm,alert,prompt的用法及返回值
- css的三种定位方式使用探讨
- 编码风格约束