第一步:下载python2.7相关版本源码(例如:Python-2.18.4.tgz)
地址:https://www.python.org/downloads/release/python-2718/
第二步:安装
1) 解压
tar zxvf Python-2.7.18.tar.tgz
2)进入文件夹:
cd Python-2.7.18
3)执行安装步骤:
要先检查环境
gcc --version
#若不存在进行安装
apt-get install gcc
gcc (Debian 12.2.0-3) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ --version
#若不存在进行安装
apt-get install g++
g++ (Debian 12.2.0-3) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
然后执行安装命令:
./configure
make
make install
4)检查是否安装成功
在命令行下输入python,出现以下显示结果即为成功。
python
Python 2.7.18 (default, Nov 2 2022, 15:29:52)
[GCC 12.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
bash: pip3: command not found
问题描述:
当使用命令pip3 install XXX,
出现错误bash: pip3: command not found
错误原因:pip3
还没有安装
解决方法:
安装 pip3
sudo apt install python3-pip
直接使用apt-get安装
apt-get install python2