Monday, May 13, 2013

install Python 2.7.5 on Linux Mint

To begin, install all the development packages required to build python. Some of these may already be on your system and you may need others beyond these. These are the ones I had to add.

$ sudo apt-get install {the packages below...}
  • build-essential
  • libreadline6-dev 
  • libncursesw5-dev
  • libncurses5-dev
  • libssl-dev 
  • libsqlite3-dev 
  • tk-dev 
  • libgdbm-dev 
  • libc6-dev 
  • libbz2-dev
  • libltdl-dev
Download Python 2.7.5 tarball from python.org
Extract it and cd into that dir.

Review the README file for hints etc.
$ pg README

Generate a make file
$ ./configure

Run generated make file to compile Python executable
$ make
NOTE: renamed /usr/local/bin/python to python2.75 so apps like minkupdate would not be broken. need to get pygtk built into /usr/local/bin/python before things are fully happy. stay tuned for resolution......



Install the new Python
$ su root
# make altinstall


Notes: 
  • If you need to restart or repeat the running of make 
    • $ make clean 
    • will delete all files from previous runs of make
  • 2.7.5 will be installed in /usr/local/bin while 2.7.3 remains in /usr/bin
  • The installation of build-essential is require as explained here. Note the other packages listed above are required to compile a fully functioning python executable. if some are missing compile will still work but functionality may be missing (like readline which is required for python shell command recall)
  • Use of altinstall explained here
  • To use this new version of python with virtual environments:
    • change to dir you want to create a vitual environment in
    • $ virtualenv -v -p /usr/local/bin/python venv
    • above command will run in verbose mode and use specified python to create a virt env called "venv".
    • If above command fails with error like can't import zlib it means you did not have all the required packages installed to your system prior to compiling and installing your new version of python.
    • Carefully read the error messages at the end of the running of Make to see you are still missing any required packages
Outstanding:
  • ensure Pycharm works as expected with 2.7.4



No comments:

Post a Comment