Linux安裝Python3
1、檢視Python版本
[root@93 ~]# python -V #注意,是大寫的V
Python 2.7.5
2、安裝Python可能需要依賴的庫
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
3、下載Python3的壓縮包
到Python官網下載 https://www.python.org
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0b5.tgz
4、解壓縮Python壓縮包
[root@Zabbix93 ~]# tar -zxf Python-3.7.0b5.tgz
[root@Zabbix93 ~]# cd Python-3.7.0b5
[root@Zabbix93 Python-3.7.0b5]# ls
aclocal.m4 configure Grammar Lib Mac Modules PC pyconfig.h.in setup.py
config.guess configure.ac Include LICENSE Makefile.pre.in Objects PCbuild Python Tools
config.sub Doc install-sh m4 Misc Parser Programs README.rst
5、編譯安裝Python3.7
./configure --prefix=/usr/local/ //安裝到/usr/local目錄
我這裡提示報錯,原因:缺少編譯器。解決方法:安裝gcc
[root@Zabbix93 Python-3.7.0b5]# ./configure --prefix=/usr/local/
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/Python-3.7.0b5`:
configure: error: no acceptable C compiler found in $PATH
See `config.log` for more details
[root@Zabbix93 Python-3.7.0b5]# yum install -y gcc
[root@Zabbix93 Python-3.7.0b5]# ./configure --prefix=/usr/local/
[root@Zabbix93 Python-3.7.0b5]# make
[root@Zabbix93 Python-3.7.0b5]# make altinstall //此處不能用install安裝,因為install不區分版本,會出現多版本混亂的問題
6、更改Python預設連結
python3.7程式的執行檔案:/usr/local/bin/python3.7
python3.7應用程式目錄:/usr/local/lib/python3.7
pip7的執行檔案:/usr/local/bin/pip3.7
pyenv3的執行檔案:/usr/local/bin/pyenv-3.7
更改Python預設連結:
# cd/usr/bin
# mv python python.backup
# ln -s /usr/local/bin/python3.7 /usr/bin/python
# ln -s /usr/local/bin/python3.7 /usr/bin/python3
相關文章
- linux安裝python3(原始碼安裝)LinuxPython原始碼
- Linux安裝Python3後,如何使用pip命令LinuxPython
- brew 安裝python3:如何使用brew安裝Python3Python
- CentOS 安裝Python3CentOSPython
- centOS安裝python3CentOSPython
- mac安裝python3MacPython
- 為CentOS安裝python3CentOSPython
- python3安裝scrapy框架Python框架
- Python3安裝requests庫Python
- python3環境安裝Python
- rhel7安裝python3Python
- 怎麼解除安裝python3Python
- python3環境如何安裝Python
- mac上如何安裝python3MacPython
- windows10 安裝python3WindowsPython
- linux中安裝JDK linux中安裝Tomcat linux中安裝Mysql 及故障解析 linux系統安裝redisLinuxJDKTomcatMySqlRedis
- 如何在MacOS下安裝Python3MacPython
- CentOS7快速安裝python3CentOSPython
- CentOS探索之路3—安裝python3CentOSPython
- python3如何安裝bs4Python
- Win10 安裝 Python3 (上)Win10Python
- (原創)在Linux上安裝執行Python3(CentOS7為例)LinuxPythonCentOS
- Linux安裝解除安裝MySQLLinuxMySql
- linux 安裝yum 安裝phpLinuxPHP
- LINUX 安裝python3 命令之後 python無法使用的解決辦法LinuxPython
- Linux 解除安裝openjdk 安裝oraclejdkLinuxJDKOracle
- linux 解除安裝jdk和安裝LinuxJDK
- linux下安裝snap安裝工具Linux
- centos7編譯安裝python3CentOS編譯Python
- CentOS下編譯安裝Python3教程CentOS編譯Python
- Python3爬蟲利器:Appium的安裝Python爬蟲APP
- CentOS 7下編譯安裝Python3CentOS編譯Python
- CentOS 7 如何編碼安裝Python3?CentOSPython
- Linux安裝之Linux mintLinux
- 11. Oracle for Linux安裝和配置——11.2. Linux安裝和配置——11.2.2.Linux安裝(1)OracleLinux
- 11. Oracle for Linux安裝和配置——11.2. Linux安裝和配置——11.2.2.Linux安裝(2)OracleLinux
- Linux安裝KibanaLinux
- MongoDB | Linux 安裝MongoDBLinux