wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
依赖库不安装好,会出现没有pip的情况
yum install -y gcc gdb strace gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \
curl curl-devel e2fsprogs patch e2fsprogs-devel krb5-devel libidn libidn-devel openldap-devel nss_ldap \
openldap-clients openldap-servers libevent-devel libevent openssl openssl-deve sqlite-devel -y
python:~/tools #tar zxfv Python-3.5.2.tgz
python:~/tools #cd Python-3.5.2
python:~/tools/Python-3.5.2 #./configure --prefix=/usr/local/python3
python:~/tools/Python-3.5.2 #make && make install
python:/usr/local #pwd
/usr/local
python:/usr/local #ls python3/bin/
2to3 2to3-3.5 easy_install-3.5 idle3 idle3.5 pip3 pip3.5 pydoc3 pydoc3.5 python3 python3.5 python3.5-config python3.5m python3.5m-config python3-config pyvenv pyvenv-3.5
python:/usr/local #ln -s /usr/local/python3 python
python:/usr/local #tail -1 ~/.bash_profile
export PATH=$PATH:/usr/local/python/bin/
python:/usr/local #. ~/.bash_profile
python:~/tools #cat ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
python:~ #pip3 install virtualenv
python:~ #pip3 install virtualenvwrapper
python:~ #pip list
Package Version
----------------- -------
pbr 5.4.4
pip 20.0.2
setuptools 20.10.1
six 1.14.0
stevedore 1.31.0
virtualenv 16.7.9
virtualenv-clone 0.5.3
virtualenvwrapper 4.8.4
python:~ #rpm -qa|grep python
python-2.7.5-34.el7.x86_64
dbus-python-1.1.1-9.el7.x86_64
python:~ #mv /usr/bin/python /opt
python:~ #ln -s /usr/local/python3/bin/python3 /usr/bin/python
python:~ #mkdir ~/.virtualenvs
python:~ #tail -2 ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/python3/bin/virtualenvwrapper.sh
python:~ #. ~/.bash_profile