gpt4 book ai didi

python - 在 Debian 8 上安装 Python 3.6 期间出现段错误

转载 作者:行者123 更新时间:2023-12-02 11:21:18 25 4
gpt4 key购买 nike

我正在尝试在 Debain 8 上安装 Python 3.6。当我运行 make命令,发生错误。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8.11
Codename: jessie

我运行的命令:
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xvf Python-3.6.3.tgz
cd Python-3.6.3
./configure --enable-optimizations
make -j8 # Error occurs here
sudo make altinstall
python3.6

这就是错误
...
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm _gdbm _lzma
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 /home/lucas/Python-3.6.3/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/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
Segmentation fault


Makefile:586: recipe for target 'sharedmods' failed
make[2]: *** [sharedmods] Error 139
make[2]: Leaving directory '/home/lucas/Python-3.6.3'
Makefile:479: recipe for target 'build_all_generate_profile' failed
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory '/home/lucas/Python-3.6.3'
Makefile:460: recipe for target 'profile-opt' failed
make: *** [profile-opt] Error 2

最佳答案

警告:
如果您因为安装失败而尝试此操作,请尽可能多地删除失败的安装,因为将损坏的安装留在您的计算机上不是一个好主意(它往往会破坏重新安装)
尝试:

rm -rfv <broken_python_version>
locate <broken_python_version>
rm -rfv `locate <broken_python_install>`
指示
尝试使用 apt 安装这些模块首先通过使用
sudo apt update 
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev tk-dev liblzma-dev lzma
然后使用 wget 下载 python:
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
或从 python official website 下载最新版本.要构建 python,请输入:
tar -xf Python-3.6.3.tgz && rm Python-3.6.3.tgz # or your python version
cd Python-3.6.3 # or your python version
./configure --enable-optimizations
make -j `nproc` # optimized for the number of processors on your computer
sudo make altinstall
要测试 python 安装是否有效,请尝试:
python3 --version # python3 can be replaced with python3.8 depending on your python version

关于python - 在 Debian 8 上安装 Python 3.6 期间出现段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52561997/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com