python2.7.5

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python2.7.5相关的知识,希望对你有一定的参考价值。

 

 

 ./configure --prefix=/usr/local/python2.7.5

 

gcc -pthread  -Xlinker -export-dynamic -o python                 Modules/python.o                 libpython2.7.a -lpthread -ldl  -lutil   -lm  
libpython2.7.a(posixmodule.o): In function `posix_tmpnam:
/root/Python-2.7.5/./Modules/posixmodule.c:7515: warning: the use of `tmpnam_r is dangerous, better use `mkstemp
libpython2.7.a(posixmodule.o): In function `posix_tempnam:
/root/Python-2.7.5/./Modules/posixmodule.c:7462: warning: the use of `tempnam is dangerous, better use `mkstemp
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
make: *** [Makefile:464: pybuilddir.txt] Segmentation fault (core dumped)
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5/
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5/ -al

 

解决:

查看Python路径相关环境变量的意义。

  • PYTHONHOME :指定 Python 的标准库。
  • PYTHONPATH :用于扩充 Python 查找模块文件的路径。

这里是导入 site 模块时出错,所以应该在 PYTHONPATH 上增加 site 模块的路径。

查找site相关文件的路径:

[root@tZ etc]# find / -name site.py*
/usr/lib64/python2.7/site.pyc
/usr/lib64/python2.7/site.py
/usr/lib64/python2.7/site.pyo

增加路径到环境变量:

[root@host-10-10-18-131 Python-2.7.5]# export PYTHONPATH=$PYTHONPATH:/usr/local/python2.7.5
[root@host-10-10-18-131 Python-2.7.5]# make -j 4
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
make: *** [Makefile:464: pybuilddir.txt] Segmentation fault (core dumped)
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  python2.7.5  sbin  share  src
[root@host-10-10-18-131 Python-2.7.5]# mkdir -p /usr/local/python2.7
[root@host-10-10-18-131 Python-2.7.5]# ./configure --prefix=/usr/local/python2.7

 

以上是关于python2.7.5的主要内容,如果未能解决你的问题,请参考以下文章

windows XP上实现python2.7.5和python3.4.3共存

python2.7.5升级到2.7.14或者直接升级到3.6.4

python2.7.5升级到3.5.0

Python2.7.5安装pip9.0.1

Centos7卸载Python2.7.5&安装Python3.9.0的方法

我的linux版本是centos6.4,由于想升级python2.7.5(自带)到python3.3,出现yum不用使用