Python 2.7.2安装困难
问题描述:
我试图从我的Linux
机器的源文件中安装Python 2.7.2
。但是我遇到了以下讨论earlier的问题。Python 2.7.2安装困难
Traceback (most recent call last):
File "https://*.com/a/b/python2.7.2/linux26_x86_64/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "https://*.com/a/b/python3.7.2/linux26_x86_64/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
gmake: *** [libinstall] Error 1
我跟着答案提供的link,并试图建议由Hans Lellelid(hozn)修改site.py
但仍没有运气。
我的系统细节:
% cat /etc/*-release
CentOS release 4.6 (Final)
% uname -av
Linux scdbuild04 2.6.9-67.ELsmp #1 SMP Fri Nov 16 12:49:06 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
% gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
答
我以前Activestate Python安装Python 2.7。我也碰到了一个安装问题,通过设置PYTHONHOME
env变量解决了这个问题,正如answer所述。
% setenv PYTHONHOME /a/b/python2.7.2/linux26_x86_64
% tar -xzf ActivePython-2.7.2.5-linux-x86_64.tar.gz
% cd ActivePython-2.7.2.5-linux-x86_64
% ./install.sh -I /a/b/python2.7.2/linux26_x86_64
您是否必须使用CentOS的旧版本?在当代发行版 – tMC 2012-02-16 00:20:12
@tMC上这会很容易。不幸的是我坚持这一点。 – Anand 2012-02-16 00:49:05
它们是否与构建_struct有关的任何构建错误? – tMC 2012-02-16 00:51:32