3

Ok, i want to run a django web-application on a production VPS with CentOS. The application code is written using Python 2.7.

I have already installed Python 2.7 with a configured virtual environment by following this guide. But because I'm planning to use MySQL as a database and for other purposes, I must install package python-devel. I tried to install it with

yum install python-devel

and got a package for an older version of Python. How can I install this package for Python v. 2.7? If I overwrite standard Python, then the couple of packages of the system (such as yum, for example) will be corrupted. Please, tell me, how to resolve this problem.

UPDATE Information about versions:

  • CentOS 6.4
  • Django 1.4
  • Python 2.7.3
  • MySQL 14.14
  • What is you Cent OS version? – Rajat Apr 11 '13 at 13:18
  • Cent OS version is 6.4 – zen11625 Apr 11 '13 at 13:22
4

Your question makes no sense, I'm afraid. You've built python from source, and installed it in an alternate location (/usr/local/bin, if the linked article is right). Once you build from source, you've departed completely from the foo, foo-devel convention of package management. Or, in short, there is no python-devel for a built-from-source install.

But you will have installed the necessary libraries as part of that build; they're probably in /usr/local/lib. In order to use these, it will be necessary to direct each new piece of software that you want to compile, to find the new python libraries in preference to the standard system ones. Sometimes, putting /usr/local/bin first in your path, so that running python picks up the new version, will be enough; sometimes, there will be an environment variable that directs the build to look in a certain location (eg, export PYTHON_LIBDIR=/usr/local/lib; sometimes, there will be a configure flag (eg ./configure --python-libs=/usr/local/lib). It will vary from build to build, and you will have to experiment with each build.

If you are thinking that this is painful, you are right; there is a reason why software packaging systems became very popular over the last 20 years; by building a major system component by hand from source you've just stepped back to the early '90s - good luck!

1

Why not use the IUS repository to install your new python versions, you can install 2.7 and 3.3, and they do not overwrite the existing python installations (like the one yum uses).

http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/

Notice that in there the packages are called python27, not python-2.7..

0

I hate to dig up an old one, but people are still going through this process so I'll chime in.. The process posted by Rajat is correct in a sense. If you have installed "dev tools" group and also altinstall'd python2.7.3, you are on the right track.

You must run the yum install python-devel and it will install for 2.6. This is normal. Go ahead and install any other python libs/mods you need. (I can't say they all work this way) Now go back to where you unpacked your python gzip and rerun:

# ./configure --prefix=/usr/local
# make && make altinstall

I would say work towards getting pip and easy_install setup for 2.7 to make later package installs a bit easier.

This works for 2.7.5 also..

-1

Install development tools

 # yum groupinstall "Development tools"
 # yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

Download and install Python

# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
# tar xf Python-2.7.3.tar.bz2
# cd Python-2.7.3
# ./configure --prefix=/usr/local
# make && make altinstall

Using above step I have install python 2.7 on Cent OS 6.3

  • 2
    If you read the linked article from the question, you'll see that that is what he's already done. – MadHatter Apr 11 '13 at 13:28

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.