Deepin 深度系统 安装Python3.10.6
Excerpt
Deepin 深度系统 安装 Python3.9.16
1、安装前准备
sudo apt update
sudo apt upgrade
2、安装必需的依赖
sudo apt install make build-essential libssl-dev zlib1g-dev
sudo apt install libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
sudo apt install libncurses5-dev libncursesw5-dev xz-utils tk-dev
3、下载 python3.10.6 包
我是 普通用户在/opt 编译安装的
cd /opt
sudo wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
4、解压
sudo tar -zxvf Python-3.10.6tgz
5、编译
cd Python-3.10.
sudo ./configure prefix=/usr/local/python3 --with-openssl=/usr --with-http_ssl_module --enable-optimizations
sudo make
sudo make install
- 注:将python的环境编译到/usr/bin/python3的目录下,默认和python2一个目录下;如需编译到指定自定义目录,可添加 –prefix=/usr/local/python3指定
6、创建软连接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python
7、安装Pip3
cd /opt
sudo wget https://pypi.python.org/packages/source/p/pip/pip-23.0.1.tar.gz
# 解压
sudo tar -zxvf pip-23.0.1.tar.gz
# 安装
cd pip-23.0.1
sudo python3 setup.py build
sudo python3 setup.py install
# 添加到软连接
sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
8、pip3 配置
设置安装源:
pip config set global.index-url https://pypi.huaweicloud.com/simple/
pip 通用配置
Windows: ~/pip/pip.ini
Linux: ~/.pip/pip.conf
[global]
#index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
index-url = http://pypi.douban.com/simple/
#index-url = http://mirrors.aliyun.com/pypi/simple/
#index-url = http://pypi.mirrors.ustc.edu.cn/simple/
[install]
# trusted-host = pypi.tuna.tsinghua.edu.cn
trusted-host = pypi.douban.com
#trusted-host = mirrors.aliyun.com
#trusted-host = pypi.mirrors.ustc.edu.cn
9、测试
python -V
pip -V
#升级 pip
python3 -m pip install --upgrade pip
升级数据包
pip install Numpy SciPy Pandas Matplotlib Seaborn Bokeh Plotly SciKit-Learn Keras Scrapy Statsmodels opencv-python
至此,Python3已安装完成!!!