Mysql – Python-devel for python 2.7 on CentOS 6.4

centos6djangoMySQLpython

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

Best Answer

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!

Related Topic