首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在debian 10上使用checkinstall安装python3.8?

如何在debian 10上使用checkinstall安装python3.8?
EN

Stack Overflow用户
提问于 2020-08-08 18:17:11
回答 2查看 2K关注 0票数 1

我已经在服务器上安装了debian 10。

代码语言:javascript
复制
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
ID=debian
arch: x86_64

它安装了python版本3.7.3,所以我尝试将其更新到版本3.8.5,并且我想使用checkinstall。我在sources.list中添加了backports存储库,并安装了checkinstall:

代码语言:javascript
复制
# install checkinstall 
sudo apt install checkinstall
sudo apt update

然后我得到了python:

代码语言:javascript
复制
# download python in tar.xz
cd /opt
curl -O https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
tar -xf Python-3.8.5.tar.xz
cd Python-3.8.5

但是当我尝试这个的时候

代码语言:javascript
复制
./configure --enable-optimizations
make
# Use the -n flag on make for your target and pipe to shell script
make -n altinstall > altinstall_script.sh
# run checkinstall with that shell script
chmod +x altinstall_script.sh
# and install
sudo checkinstall ./altinstall_script.sh --install

我得到了错误:

代码语言:javascript
复制
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                                                           
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:
_abc                  atexit                pwd                
time                                                           

running build_scripts
copying and adjusting /opt/Python-3.8.5/Tools/scripts/pydoc3 -> build/scripts-3.8
copying and adjusting /opt/Python-3.8.5/Tools/scripts/idle3 -> build/scripts-3.8
copying and adjusting /opt/Python-3.8.5/Tools/scripts/2to3 -> build/scripts-3.8
changing mode of build/scripts-3.8/pydoc3 from 644 to 755
changing mode of build/scripts-3.8/idle3 from 644 to 755
changing mode of build/scripts-3.8/2to3 from 644 to 755
renaming build/scripts-3.8/pydoc3 to build/scripts-3.8/pydoc3.8
renaming build/scripts-3.8/idle3 to build/scripts-3.8/idle3.8
renaming build/scripts-3.8/2to3 to build/scripts-3.8/2to3-3.8
running install_lib
copying build/lib.linux-x86_64-3.8/_multibytecodec.cpython-38-x86_64-linux-gnu.so -> /usr/local/lib/python3.8/lib-dynload
error: [Errno 2] No such file or directory
rm: cannot remove '/usr/local/lib/python3.8/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py': No such file or directory
rm: cannot remove '/usr/local/lib/python3.8/lib-dynload/__pycache__': No such file or directory
Creating directory /usr/local/share/man/man1
Looking in links: /tmp/tmpaf3jv392
Processing /tmp/tmpaf3jv392/setuptools-47.1.0-py3-none-any.whl
Processing /tmp/tmpaf3jv392/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory

C

EN

回答 2

Stack Overflow用户

发布于 2020-08-08 20:25:38

这似乎适用于我:安装pyenv并使用它来安装python3.8.5。

我运行了以下命令:

代码语言:javascript
复制
# Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

# Load pyenv automatically by adding the following to ~/.bashrc:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

# Check versions
pyenv install --list | grep " 3\.[678]"
# install python 3.8.5
pyenv install -v 3.8.5
# set python 3.8.5
pyenv global 3.8.5

# Now I can use python2 and python3
python2 -V    # -> Python 2.7.16
python3 -V    # -> Python 3.8.5
python -V     # -> Python 3.8.5
pip -V        # -> pip 20.1.1 from /root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)
pip2 -V       # -> pip 20.2.1 from /root/.local/lib/python2.7/site-packages/pip (python 2.7)
pip3 -V       # -> pip 20.1.1 from /root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)

# or return to system python
pyenv global system
# and then 
python2 -V    # -> Python 2.7.16
python -V     # -> Python 2.7.16
python3 -V    # -> Python 3.8.5

# and versions
pyenv versions

也许,您还需要安装依赖项:

代码语言:javascript
复制
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
票数 2
EN

Stack Overflow用户

发布于 2020-08-08 18:26:11

我认为您在列出要安装的版本时出错了,请查看本指南以了解更多信息- https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/

代码语言:javascript
复制
$ python3.8 --version

添加这段代码应该会有所帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63314253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档