Python 2.7.2安装困难

发布于 2025-01-06 14:14:53 字数 1311 浏览 0 评论 0原文

我正在尝试从我的 Linux 计算机中的源文件安装 Python 2.7.2。但我遇到了以下问题,之前已经讨论过

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

我按照答案中提供的 链接 进行操作,并尝试了 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)

I am trying to install Python 2.7.2 from source files in my Linux machine. But I am running into the following problem which has been discussed 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

I followed the link provided in the answer and tried a suggestion by Hans Lellelid (hozn) to modify site.py but still no luck.

My system details are:

% 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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

分開簡單 2025-01-13 14:14:53

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

I used Activestate Python for installing Python 2.7. I also ran into a problem in the installation which was solved by setting PYTHONHOME env variable correctly as described in this 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文