python编译安装和使用问题处理

编译安装Python3.8.5

yum install libffi-devel gcc zlib-devel -y

新系统可能需要安装以下包
-----
yum install libffi-devel gcc bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
-----

cd  /usr/local/src
wget -S  "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  
./configure --prefix=/usr/local/python385 --enable-optimizations
make
make install

pip install -r piplist.txt报错

ModuleNotFoundError: No module named '_ctypes'
解决
需要安装 libffi-dev,然后重新编译安装python3.8

步骤1“
RHEL/Fedora:
yum install libffi-devel

or
sudo dnf install libffi-devel

using Debian/Ubuntu:
sudo apt-get install libffi-dev
步骤二:
cd  /usr/local/src/Python-3.8.5
./configure --prefix=/usr/local/python385 --enable-optimizations
make && make install 

pip 安装Python虚拟环境

上面将Python3.8.5安装到了 /usr/local/python385目录中,现在需要python385的虚拟环境
创建一个  tutorial-env 目录,目录下包含Python385版本虚拟环境
/usr/local/python385/bin/python3   -m  venv tutorial-env

本文链接:python3-make-install

写的不错,赞助一下

扫一扫,用支付宝赞赏
扫一扫,用微信赞赏

暂无评论~~