2018 Install Python3 on CentOS

本文介绍在CentOS上安装Python 3的方法,并演示如何通过YUM和构建安装方式来实现。此外,还提供了安装Twisted、Scrapy等常用Python库的步骤,以及配置带有Sqlite3支持的Python环境的详细过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2018 Install Python3 on CentOS

Try with YUM Install
> sudo yum update
> sudo yum install yum-utils
> sudo yum groups mark install development

> sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
It seems not work. Try with build installation.

Build Install
> sudo yum install yum-utils
> wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5rc1.tgz
Unzip
> tar xf Python-3.6.5rc1.tgz

Configure and Make and Make Install
After Installation
> python -V
Python 2.7.13

> python3 -V
Python 3.6.5rc1

It works, that is cool.

Rollback the Python to 3.6.4
https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

Install Twisted
> wget http://twistedmatrix.com/Releases/Twisted/17.9/Twisted-17.9.0.tar.bz2
> tar xjf Twisted-17.9.0.tar.bz2
> python setup.py install

Install Scrapy
> pip install scrapy

Reinstall Python3 with Sqlite3
https://stackoverflow.com/questions/42766063/python3-6-import-sqlite3-error

Install Sqlite3
> wget https://www.sqlite.org/2018/sqlite-autoconf-3220000.tar.gz
Unzip and configure and install
> ./configure --prefix=/usr/local/sqlite3 --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1"
Make and make install

Reinstall Python3.6.4
> wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
Unzip and configure and install
> LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I /usr/local/sqlite3/include"

> LD_RUN_PATH=/usr/local/sqlite3/lib make
> sudo LD_RUN_PATH=/usr/local/sqlite3/lib make install

Redo the Installation for other features.

Install Chromedriver
https://makandracards.com/makandra/29465-install-chromedriver-on-linux
> wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip

Unzip and give permission
> chmod a+x chromedriver
> sudo mv chromedriver /usr/local/bin/
Check installation
> chromedriver
Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 9515
Only local connections are allowed.

> sudo ln -s /usr/local/bin/chromedriver /usr/bin/chromedriver

https://stackoverflow.com/questions/8255929/running-selenium-webdriver-python-bindings-in-chrome/24364290#24364290
https://github.com/jciolek/docker-protractor-headless

Test Browser on my Ubuntu
http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/

> sudo apt-get install xvfb
Find the package here
https://www.ubuntuupdates.org/ppa/google_chrome?dist=stable

My ARM system does not work.
> sudo apt-get install chromium-browser

> chromium-browser --version
Chromium 56.0.2924.84 Built on Ubuntu 14.04, running on Raspbian 8.0

Check the things on CentOS
> yum info xorg-x11-server-Xvfb
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
Name : xorg-x11-server-Xvfb
Arch : x86_64
Version : 1.15.0
Release : 26.41.amzn1
Size : 1.8 M
Repo : installed
From repo : amzn-main
Summary : A X Windows System virtual framebuffer X server.
URL : http://www.x.org
License : MIT and GPLv2
Description : Xvfb (X Virtual Frame Buffer) is an X server that is able to run on
: machines with no display hardware and no physical input devices.
: Xvfb simulates a dumb framebuffer using virtual memory. Xvfb does
: not open any devices, but behaves otherwise as an X display. Xvfb
: is normally used for testing servers.

https://reiners.io/installing-xvfb-in-centos/

References:
http://sillycat.iteye.com/blog/2358165
https://janikarhunen.fi/how-to-install-python-3-6-1-on-centos-7.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值