apt-get -y update
apt-get -y upgrade
apt-get -y install python
apt-get -y install python-setuptools
apt-get -y install python-pip
apt-get -y install python-virtualenv
cd ~
curl -kL https://raw.github.com/saghul/pythonz/master/pythonz-install | bash
echo '[[ -s $HOME/.pythonz/etc/bashrc ]] && source $HOME/.pythonz/etc/bashrc' >> ~/.bashrc
source ~/.bashrc
You can install any version you like. Install the latest 2 series for the time being
pythonz install 2.7.5
virtualenv -p ~/.pythonz/pythons/CPython-2.7.5/bin/python ~/.pythonz/virtualenv/Python-2.7.5
echo 'PATH=$HOME/.pythonz/virtualenv/Python-2.7.5/bin:$PATH' >> ~/.profile
source ~/.profile
cd ~/.pythonz/virtualenv/Python-2.7.5/lib/python2.7/site-packages
touch sitecustomize.py
echo 'import sys' >> sitecustomize.py
echo 'sys.setdefaultencoding("utf-8")' >> sitecustomize.py
```
With Pythonz + virtualenv, you will be able to manage versions and packages without polluting the global python environment.
Recommended Posts