Skip to main content
 首页 » 编程设计

python之Installing Python3.4.3 : 3 tests failed, 修改执行环境3个,跳过25个

2025年05月04日10mq0036

我使用 Lubuntu 14.04 作为 guest 操作系统(使用 VMplayer)。我想安装python3.4.3。我从这里下载了 .tar.xz 文件: https://www.python.org/downloads/

然后我提取文件并按照自述文件中的说明进行操作:

./configure 
make 
make test 

当我运行时

make test 

它返回了这个:

359 tests OK. 
3 tests failed: 
    test_urllib test_urllib2 test_urllib2net 
3 tests altered the execution environment: 
    test___all__ test_site test_warnings 
25 tests skipped: 
    test_bz2 test_curses test_dbm_gnu test_dbm_ndbm test_devpoll 
    test_gdb test_gzip test_idle test_kqueue test_lzma test_msilib 
    test_ossaudiodev test_readline test_smtpnet test_sqlite test_ssl 
    test_startfile test_tcl test_tk test_ttk_guionly test_ttk_textonly 
    test_winreg test_winsound test_zipfile64 test_zlib 
Re-running failed tests in verbose mode 
Re-running test 'test_urllib' in verbose mode 
test test_urllib crashed -- Traceback (most recent call last): 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/regrtest.py", line 1271, in runtest_inner 
    the_module = importlib.import_module(abstest) 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/importlib/__init__.py", line 109, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import 
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load 
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked 
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked 
  File "<frozen importlib._bootstrap>", line 1129, in _exec 
  File "<frozen importlib._bootstrap>", line 1471, in exec_module 
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib.py", line 13, in <module> 
    import ssl 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/ssl.py", line 97, in <module> 
    import _ssl             # if we can't import it, let the error propagate 
ImportError: No module named '_ssl' 
 
Re-running test 'test_urllib2' in verbose mode 
test test_urllib2 crashed -- Traceback (most recent call last): 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/regrtest.py", line 1271, in runtest_inner 
the_module = importlib.import_module(abstest) 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/importlib/__init__.py", line 109, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import 
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load 
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked 
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked 
  File "<frozen importlib._bootstrap>", line 1129, in _exec 
  File "<frozen importlib._bootstrap>", line 1471, in exec_module 
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib2.py", line 3, in <module> 
    from test import test_urllib 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib.py", line 13, in <module> 
    import ssl 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/ssl.py", line 97, in <module> 
    import _ssl             # if we can't import it, let the error propagate 
ImportError: No module named '_ssl' 
 
Re-running test 'test_urllib2net' in verbose mode 
test test_urllib2net crashed -- Traceback (most recent call last): 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/regrtest.py", line 1271, in runtest_inner 
    the_module = importlib.import_module(abstest) 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/importlib/__init__.py", line 109, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import 
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load 
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked 
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked 
  File "<frozen importlib._bootstrap>", line 1129, in _exec 
  File "<frozen importlib._bootstrap>", line 1471, in exec_module 
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib2net.py", line 3, in <module> 
    from test.test_urllib2 import sanepathname2url 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib2.py", line 3, in <module> 
    from test import test_urllib 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/test/test_urllib.py", line 13, in <module> 
    import ssl 
  File "/home/ayman/Downloads/python3.4.3/Python-3.4.3/Lib/ssl.py", line 97, in <module> 
    import _ssl             # if we can't import it, let the error propagate 
ImportError: No module named '_ssl' 
 
make: *** [test] Error 1 

我不确定这些失败/跳过的测试在我安装 Python3.4.3 后的长期运行中对我有什么影响:

sudo make install 

我应该担心这些失败/跳过的测试吗?如果是,关于如何解决这些问题有什么想法吗?

请您参考如下方法:

您似乎在不支持 ssl 或 zlib 的情况下编译 Python。这就是为什么有些测试失败而有些测试被跳过的原因。

您可能想查看 How to compile Python 2.4.6 with ssl, readline and zlib on Debian Lenny和 No module named zlib found .