【问题标题】:Python 2.7.2 installation difficultiesPython 2.7.2 安装困难
【发布时间】:2012-02-15 23:36:16
【问题描述】:

我正在尝试从我的Linux 机器中的源文件安装Python 2.7.2。但是我遇到了earlier讨论过的以下问题。

Traceback (most recent call last):
  File "/a/b/python2.7.2/linux26_x86_64/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/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)

【问题讨论】:

  • 你非得用这么旧的CentOS吗?在当代发行版上会容易得多
  • @tMC 这是在工作。不幸的是,我对此感到困惑。
  • 他们是否有任何与 _struct 的构建有关的构建错误?
  • 如果您只是将它安装到 virtualenv 中,这不是更安全吗?
  • 我遇到了同样的问题并通过本指南取得了成功:villaroad.com/2010/10/rolling-python-2-6-2-on-centos-5-3

标签: python linux compiler-errors redhat


【解决方案1】:

我使用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

【讨论】:

    猜你喜欢
    • 2011-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多