我正在尝试使用 gcc 3.4.2 在 Solaris 8 上构建 python 2.5.2。我在 ./configure 步骤中看不到任何直接错误,但是,一旦构建,我进入 python shell 执行导入时间错误:
Python 2.5.2 (r252:60911, Nov 21 2008, 18:45:42)
[GCC 3.4.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named time
我做错了什么?从我粗略的谷歌可以看出,libstdc++.so 可能有错误,但我找不到任何硬性细节。
欢迎提出任何建议。
非常感谢,
铝
最佳答案
时间模块在 Python 中不是默认构建的,如果您从源代码分发中构建,您需要显式启用所有要编译的模块。
在 python 源代码树中打开 Modules/Setup.dist 并注释掉以下内容的行:
#time timemodule.c
启用时间模块的构建。还要记住,您需要重新编译 Python 才能生效。
关于Python 2.5.2 和 Solaris 8 (gcc 3.4.2) 构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/314749/