Python-3.7.0 原始碼安裝
阿新 • • 發佈:2018-12-13
1、依賴包安裝: yum install libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make 2、python原始碼包:Python-3.7.0.tgz tar -xzvf Python-3.7.0.tgz cd Python-3.7.0 3、編譯 ./configure --prefix=/usr/local/python make -j 2 4、安裝 make install 5、檢視擴充套件安裝包: /usr/local/python/bin/pip3 list Package Version pip 10.0.1 setuptools 39.0.1 6、新增Python命令到環境變數: vim ~/.bash_profile 增加一行 PATH=$PATH:/usr/local/python/bin 7、使環境變數生效: source ~/.bash_profile 8、檢視Python版本: python3.7 -V 9、更改系統預設python版本為Python3.7 mv /usr/bin/python /usr/bin/python2.7 ln -s /usr/local/python/bin/python3.7 /usr/bin/python 10、解決python升級後,YUM不能正常工作的問題 vi /usr/bin/yum #!/usr/bin/python 改成 #!/usr/bin/python2.7 11、python -V Python 3.7.0