我刚刚安装了Linux Mint 18.1(所以我不熟悉Linux而且我不知道我在做什么!)并且我试图安装Python 3.6.1。 但是,其中一个安装测试仍然失败 - test_venv。 这是日志:
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
warning: building with the bundled copy of libffi is deprecated on this platform. It will not be distributed with Python 3.7
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit pwd time
running build_scripts
copying and adjusting /opt/Python-3.6.1/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /opt/Python-3.6.1/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /opt/Python-3.6.1/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /opt/Python-3.6.1/Tools/scripts/pyvenv -> build/scripts-3.6
changing mode of build/scripts-3.6/pydoc3 from 644 to 755
changing mode of build/scripts-3.6/idle3 from 644 to 755
changing mode of build/scripts-3.6/2to3 from 644 to 755
changing mode of build/scripts-3.6/pyvenv from 644 to 755
renaming build/scripts-3.6/pydoc3 to build/scripts-3.6/pydoc3.6
renaming build/scripts-3.6/idle3 to build/scripts-3.6/idle3.6
renaming build/scripts-3.6/2to3 to build/scripts-3.6/2to3-3.6
renaming build/scripts-3.6/pyvenv to build/scripts-3.6/pyvenv-3.6
./python ./Tools/scripts/run_tests.py -v test_venv
/opt/Python-3.6.1/python -W default -bb -E -W error::BytesWarning -m test -r -w -j 0 -u all,-largefile,-audio,-gui -v test_venv
== CPython 3.6.1 (default, Apr 16 2017, 09:33:09) [GCC 5.4.0 20160609]
== Linux-4.4.0-53-generic-i686-athlon-with-debian-stretch-sid little-endian
== hash algorithm: siphash24 32bit
== cwd: /opt/Python-3.6.1/build/test_python_21688
== encodings: locale=UTF-8, FS=utf-8
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=1, verbose=0, bytes_warning=2, quiet=0, hash_randomization=1, isolated=0)
Using random seed 8896684
Run tests in parallel using 4 child processes
0:00:03 [1/1/1] test_venv failed
test_defaults (test.test_venv.BasicTest) ... ok
test_executable (test.test_venv.BasicTest) ... ok
test_executable_symlinks (test.test_venv.BasicTest) ... ok
test_isolation (test.test_venv.BasicTest) ... ok
test_overwrite_existing (test.test_venv.BasicTest) ... ok
test_prefixes (test.test_venv.BasicTest) ... ok
test_prompt (test.test_venv.BasicTest) ... ok
test_symlinking (test.test_venv.BasicTest) ... ok
test_unoverwritable_fails (test.test_venv.BasicTest) ... ok
test_upgrade (test.test_venv.BasicTest) ... ok
test_devnull (test.test_venv.EnsurePipTest) ... ok
test_explicit_no_pip (test.test_venv.EnsurePipTest) ... ok
test_no_pip_by_default (test.test_venv.EnsurePipTest) ... ok
test_with_pip (test.test_venv.EnsurePipTest) ... FAIL
======================================================================
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 368, in do_test_with_pip
with_pip=True)
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 61, in run_with_capture
func(*args, **kwargs)
subprocess.CalledProcessError: Command '['/tmp/tmp75p27d_d/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 428, in test_with_pip
self.do_test_with_pip(False)
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 374, in do_test_with_pip
self.fail(msg.format(exc, details))
AssertionError: Command '['/tmp/tmp75p27d_d/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
**Subprocess Output**
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/Python-3.6.1/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/Python-3.6.1/Lib/ensurepip/__main__.py", line 4, in <module>
ensurepip._main()
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 189, in _main
default_pip=args.default_pip,
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 102, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
----------------------------------------------------------------------
Ran 14 tests in 2.668s
FAILED (failures=1)
test test_venv failed
1 test failed:
test_venv
Re-running failed tests in verbose mode
Re-running test 'test_venv' in verbose mode
test_defaults (test.test_venv.BasicTest) ... ok
test_executable (test.test_venv.BasicTest) ... ok
test_executable_symlinks (test.test_venv.BasicTest) ... ok
test_isolation (test.test_venv.BasicTest) ... ok
test_overwrite_existing (test.test_venv.BasicTest) ... ok
test_prefixes (test.test_venv.BasicTest) ... ok
test_prompt (test.test_venv.BasicTest) ... ok
test_symlinking (test.test_venv.BasicTest) ... ok
test_unoverwritable_fails (test.test_venv.BasicTest) ... ok
test_upgrade (test.test_venv.BasicTest) ... ok
test_devnull (test.test_venv.EnsurePipTest) ... ok
test_explicit_no_pip (test.test_venv.EnsurePipTest) ... ok
test_no_pip_by_default (test.test_venv.EnsurePipTest) ... ok
test_with_pip (test.test_venv.EnsurePipTest) ... FAIL
======================================================================
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 368, in do_test_with_pip
with_pip=True)
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 61, in run_with_capture
func(*args, **kwargs)
subprocess.CalledProcessError: Command '['/tmp/tmp0zy9q1i8/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 428, in test_with_pip
self.do_test_with_pip(False)
File "/opt/Python-3.6.1/Lib/test/test_venv.py", line 374, in do_test_with_pip
self.fail(msg.format(exc, details))
AssertionError: Command '['/tmp/tmp0zy9q1i8/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
**Subprocess Output**
Traceback (most recent call last):
File "/opt/Python-3.6.1/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/Python-3.6.1/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/Python-3.6.1/Lib/ensurepip/__main__.py", line 4, in <module>
ensurepip._main()
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 189, in _main
default_pip=args.default_pip,
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 102, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/opt/Python-3.6.1/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
----------------------------------------------------------------------
Ran 14 tests in 2.652s
FAILED (failures=1)
test test_venv failed
1 test failed again:
test_venv
Total duration: 6 sec
Tests result: FAILURE
Makefile:1018: recipe for target 'test' failed
make: *** [test] Error 1
有一些可能出错的事情 - 在顶部它提到了未找到的可选模块,但我无法弄清楚如何修复它们。我尝试用pip安装它们,但是我得到了更多的错误。我也尝试在setup.py中查找detect_modles(),但我不确定我应该从那里做什么。关于下一步去哪儿的指示?
答案 0 :(得分:1)
我也使用Linux Mint 18.1(Cinnamon),并且从源代码安装Python 3.6.0时遇到类似/相同的问题。
从源代码安装Python需要与Python无关的其他非Python模块的C ++头文件。
因此,首先使用Synaptic Package Manager逐个安装缺少的模块(在日志文件中提到)并考虑到它们也需要 DEV 文件,因此对于每个模块安装两者,模块和模块的 -dev变体。
这应该足以成功编译,就像我在笔记中所说的那样:
Sucessfully built according to with the source provided instructions :)
通常意味着没有其他问题,因为这些问题可以从日志文件和自述文件或提供下载和安装说明的站点中给出的说明中读取。
我建议你按照日志文件中给出的建议:
要查找必要的位,请在detect_modules()中的setup.py中查找模块的名称。
在那里查看模块名称并在 Synaptic Package Manager 中搜索它并将其标记为安装,然后按[Apply]按钮安装它们(不要忘记-dev版) Linux Mint 18.1附带Python 3.5,所以你可能会问自己是否真的需要3.6版本的Python?也许你可以使用3.5并通过Synaptic Package Manager作为Python 3安装它?
顺便说一句:如果你真的不知道自己在做什么,我不知道是否有可能帮助你......
和readline:
最后,在完成构建和测试之后,请注意使用
安装Python 3.6.1使 altinstall
以保留系统中已存在的标准Python版本。