為CentOS安裝python3
1. 安裝依賴
不要複製往下看
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
如果在後面提示缺少 _ctypes 那麼安裝這個↓
yum install libffi-devel -y
上面這一條是我第一次安裝時裝的東西,但是到後來有很多問題,留在這做個紀念吧,下面這個才是全面的
yum install gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel tk-devel wget curl-devel
2. 去官網找下載連結
先進入下載目錄
cd /tmp
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
3. 解壓對應的檔案
tar -zxvf Python-3.7.2.tgz
4. 為你的Python3蓋一棟房子
mkdir /usr/local/python3
5. 然後編譯
Python-3.7.2/configure --prefix=/usr/local/python3/
如果報了這個↓錯誤,哪說明沒有gcc
configure: error: no acceptable C compiler found in $PATH
那麼安裝一個
yum install gcc
安裝完gcc再編譯一下吧
如果出現 沒有模組_ctypes 那麼用第一條的下載libffi-devel然後再編譯一次!!
6. 然後make一下 (這命令都是在幹嘛)
make
7. 然後make install
make install
如果出現ModuleNotFoundError: No module sssssnamed ‘_ctypes’,其實也能用了
想解決的話看看這個,我還沒試過https://blog.csdn.net/itdabaotu/article/details/83105947
8. 建一個軟連結方便使用
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
好了直接輸入python3就可以執行了
9. 為你的pip3也建一個軟連線吧
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
相關文章
- CentOS 安裝Python3CentOSPython
- CentOS 安裝 Python3CentOSPython
- centOS安裝python3CentOSPython
- CentOS7快速安裝python3CentOSPython
- VirtualBox CentOS 7安裝Python3CentOSPython
- CentOS探索之路3—安裝python3CentOSPython
- CentOS下編譯安裝Python3教程CentOS編譯Python
- CentOS 7 如何編碼安裝Python3?CentOSPython
- centos7編譯安裝python3CentOS編譯Python
- CentOS 7下編譯安裝Python3CentOS編譯Python
- centos雲伺服器安裝Python3記錄CentOS伺服器Python
- CentOS 同時安裝多個版本的Python3CentOSPython
- (原創)在Linux上安裝執行Python3(CentOS7為例)LinuxPythonCentOS
- centos7 安裝Python3及配置環境變數CentOSPython變數
- brew 安裝python3:如何使用brew安裝Python3Python
- CentOS 6.5安裝Oracle 11.2.0.4------CentOS 6.5安裝CentOSOracle
- mac安裝python3MacPython
- Mac 安裝Python3MacPython
- CentOS安裝jdkCentOSJDK
- CentOS安裝gitCentOSGit
- Centos 安裝RedisCentOSRedis
- CentOS 安裝 mavenCentOSMaven
- CentOS Docker 安裝CentOSDocker
- centOS安裝rabbitMQCentOSMQ
- CentOS 安裝 dockerCentOSDocker
- CentOS安裝pipCentOS
- Centos安裝opensslCentOS
- CentOS 安裝ScrapyCentOS
- CentOS 安裝ErlangCentOS
- CentOS安裝GraphicsMagickCentOS
- CentOS 安裝 JDKCentOSJDK
- Centos安裝rubyCentOS
- CentOS安裝DockerCentOSDocker
- CentOS 安裝PHPCentOSPHP
- CentOS安裝MySQLCentOSMySql
- centos 安裝swftoolsCentOS
- mongo centos 安裝GoCentOS
- CentOS 安裝 VNCCentOSVNC