微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何安装libpython2.7.so

我已经安装了Python 2.6.6
[17:50:21 root@data.dev:~]# which python
/usr/local/bin/python

也是Python 2.7.6 at

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

但是缺少libpython2.7.so

[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:~]#

不知道如何解决这个问题.

有人可以帮忙吗?

您可以尝试从源中以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

然后测试得到正确的python
/usr/local/python2.7/bin/python2.7 -V

并且,作为普通用户

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

祝你好运 :)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。