centOS5安装python库的问题!

zhiying8710 2013-03-26 03:11:50
centOS5的yum用的python2.4
而生产环境需要python2.7, 于是再装一个python2.7, 程序需要用到libxml2, 这个库需要使用yum来安装, 但是安装之后py文件跑到python2.4的site-packages里去了, python2.7里显然调用不了, 也试过下载源码进行编译安装, 但是也不行, 想知道这种情况应该怎么解决, 谢谢!
...全文
117 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhiying8710 2013-03-26
  • 打赏
  • 举报
回复
自己找到解决办法了: Get libxml2-sources-2.6.20.tar.gz from ftp://xmlsoft.org/libxml2. I downloaded mine to /home/hedley/src/libxml2-sources-2.6.20.tar.gz. Note that my version of libxml2 is just an example. cd /home/hedley/src tar -xvzf libxml2-sources-2.6.20.tar.gz cd libxml2-2.6.20 ./configure make We don't need to install the libraries, so no make install. cd python CFLAGS=-I/home/hedley/src/libxml2-2.6.20/include /path/to/Python-2.4.4/bin/python setup.py build CFLAGS=-I/home/hedley/src/libxml2-2.6.20/include /path/to/Python-2.4.4/bin/python setup.py install Verify that it worked. /path/to/Python-2.4.4/bin/python Python 2.4.4 (#1, Jan 3 2008, 10:11:41) [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import libxml2 >>> import libxml2mod If you see no import errors then everything worked!

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧