python-3.6.4在centos-6.7安装:
详细步骤:
1、安装一些依赖的软件包
yum -y groupinstall “Development tools”
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
yum -y install yum-plugin-remove-with-leaves
2、下载Python3.6的源码包并编译(在/usr/local目录下)
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -vxf Python-3.6.4.tgz -C ~/apps
cd Python-3.6.4
mkdir /usr/local/python3
./configure –prefix=/usr/local/python3 –enable-shared –enable-optimizations
make
make install
3、把新安装的python3.6拷贝到/usr/bin/目录下
cp /usr/local/python3/bin/python3.6 /usr/bin/python3.6
然后新建快捷方式:
ln -s /usr/bin/python3.6 /usr/bin/python3
4、一步操作:
echo /usr/local/python3/lib/ >> /etc/ld.so.conf.d/local.conf
ldconfig
5、验证安装是否成功
/usr/bin/python3 –version
6、配置环境变量
vim /etc/profile
export PYTHON_HOME=/usr/local/python3
export PATH=$PATH:$PYTHON_HOME/bin
source /etc/profile
7、尝试安装一个模块
pip3 install beautifulsoup4
8、修改pip源:
mkdir ~/.pip
cd ~/.pip
vi pip.conf
[global]
trusted-host = pypi.douban.com
index-url = http://pypi.douban.com/simple
9、安装numpy
pip3 install numpy