12

I have installed Python 2.6.6 at

[17:50:21 root@data.dev:~]# which python
/usr/local/bin/python

also Python 2.7.6 at

[17:51:12 root@data.dev:~]# which python2.7
/usr/local/bin/python2.7

But libpython2.7.so is missing

[17:48:52 root@data.dev:~]# locate libpython2.6.so
/usr/lib64/libpython2.6.so
/usr/lib64/libpython2.6.so.1.0
/usr/lib64/python2.6/config/libpython2.6.so
[17:48:56 root@data.dev:~]# locate libpython2.7.so
[17:49:02 root@data.dev:~]#

Dont know how to fix this.

can anyone help ?

roy
  • 6,344
  • 24
  • 92
  • 174
  • 2
    Have you updated locate's database? You need to run `updatedb` to regenerate the database. You could also try to do `ldconfig -p | grep python2.7` – Enfenion Oct 27 '14 at 22:06
  • it doesn't show anything for `ldconfig -p | grep python2.7` – roy Oct 28 '14 at 13:59

3 Answers3

20

You could try compiling it from sources, in root :

yum -y install python-devel openssl openssl-devel gcc sqlite-devel

wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
tar -xvjf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared
make
make install altinstall

ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib
ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib
ln -s /usr/local/python2.7/bin/python2.7 /usr/local/bin
/sbin/ldconfig -v

Then test getting correct python /usr/local/python2.7/bin/python2.7 -V

And, as normal user :

echo "alias python='/usr/local/python2.7/bin/python2.7'" >> ~/.bashrc
source ~/.bashrc
python -V    

Good luck :)

M-Gregoire
  • 808
  • 9
  • 22
  • I dont want to make 2.7 default Python. i want to keep default to 2.6. So do I need do any changes ? – roy Oct 28 '14 at 14:16
  • Now I have another trouble. i am not able to install pip packages for 2.7. any idea how to do this ? – roy Nov 05 '14 at 14:36
  • Thanks.. this helped :) – gixxer Jul 08 '16 at 18:21
  • 1
    Please, don't. Compile stuff yourself and replace system binaries is not recommended at all, unless you fully understand what your're doing. – Bruno Medeiros Sep 20 '16 at 20:54
  • Recompile python source code and install did not help, the problem is solved until soft links are created according to your solution. Thanks. – buxizhizhoum Nov 03 '17 at 06:56
2

sudo apt-get install python2.7-dev

user2501488
  • 141
  • 3
0

For Pip you need openssl, Please install the below pkgs , before you go for pip openssl.x86_64
openssl-devel.x86_64