5

Ubuntu 14.04 from AWS ships with python 2.7.6.

Before doing anything else to the image, I do an upgrade to 2.7.10 by issuing

sudo apt-get -y install build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
mkdir -p ~/python/2.7.10
cd ~/python/2.7.10
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar xzf Python-2.7.10.tgz
cd Python-2.7.10
sudo ./configure
sudo make install
cd ~/

I use make install instead of sudo make altinstall because I want it to be the only Python 2.7 on the system, the default one.

I know there is a warning in the docs

Warning: make install can overwrite or masquerade the python binary. make altinstall is therefore recommended instead of make install since it only installs exec_prefix/bin/pythonversion.

Should I stick to make altinstall? How do I make that my default python then?

How do I deal with other libraries, like pip install --upgrade --force-reinstall pyopenssl, which compiles some C code? In order for the C code to get compiled, I need to sudo apt-get install python-dev in order to get the headers. Is this assumption wrong? I'm a bit confused about this, as I guess that the python-dev in the repo is based on 2.7.6, if that makes any sense.

Additionally, since I'm running pip in a virtualenv, when issuing pip install --upgrade --force-reinstall pyopenssl in there I do get a OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.dist-info' error, which is most likely because I'm not running sudo (but as the default user), in order for the library to get installed into the virtualenv. What is causing this? It doesn't happen if I do not upgrade but leave Python at 2.7.6

A last question: as soon as I upgrade python manually by compiling, am I disallowed to use the python-* packages (apt-get python-*) in the repo?

Thanks in advance for your help.

1

Solved this issue by leaving all at its default and using Docker for all non-standard versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.