python3环境搭建
程序员文章站
2023-11-17 17:52:04
安装依赖环境 下载python3 centos系统下安装 安装python3 报错处理 ......
安装依赖环境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
下载python3
centos系统下安装
wget https://www.python.org/ftp/python/3.7.1/python-3.7.1.tgz
安装python3
//移动到一个合适的目录方便查找 mkdir -p /usr/local/python3 mv python-3.7.1.tgz /usr/local/python3 //解压包 tar -zxvf python-3.7.1.tgz //指定编译位置,就是当前位置 ./configure --prefix=/usr/local/python3 //安装 make && make install //建立软链接 ln -s /usr/local/python3/bin/python3 /usr/bin/python3 //.bash_profile添加查找路径 path=$path:$home/bin:/usr/local/python3/bin //更新 source ~/.bash_profile
报错处理
1. modulenotfounderror: no module named '_ctypes 安装 yum install -y gcc 2. configure: error: no acceptable c compiler found in $path 安装 yum install -y libffi-devel 3. python链接已存在 改名 mv /usr/bin/python /usr/bin/python.bak
下一篇: python生成器,递归调用