赞
踩
sudo rz -be +Python-3.6.5.tgz #上传python包到服务器
tar -xvzf Python-3.6.5.tgz #解压文件
cd Python-3.6.5/ #进入目录
sudo yum -y install gcc #安装gcc等
sudo yum install openssl-devel -y #安装必要的模块
sudo ./configure --prefix=/usr/local/python --with-ssl #添加配置
sudo yum install zlib* -y
sudo make #编译源码
sudo make install
**!!!如果过程中安装出错,需要重新安装**
#sudo vi /usr/libexec/urlgrabber-ext-down
将/usr/bin/python改为/usr/bin/python2.7
#sudo vi /usr/bin/yum-config-manager
将 #!/usr/bin/python换成 #!/usr/bin/python2.7
#sudo vi /usr/bin/yum
将#!/usr/bin/python改为#!/usr/bin/python2
cd /usr/local/python/bin
sudo ./pip3 install selenium
一.升级yum(防止不要的麻烦) sudo yum update -y sudo yum -y groupinstall "Development tools" sudo yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite- devel psmisc libffi-devel 二.配置谷歌浏览器安装 第一步 sudo vi /etc/yum.repos.d/google-chrome.repo 第二步 #按i进入编辑模式粘贴内容 [google-chrome] name=google-chrome baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub #:wq保存退出 第三步 sudo yum -y install google-chrome-stable #查看版本yum list | grep chrome #安装是否成功查询 #google-chrome --version
驱动去官网下载:https://sites.google.com/a/chromium.org/chromedriver/downloads
权限
sudo chmod +x chromedriver
移动文件
sudo cp chromedriver /usr/local/share/chromedriver
sudo cp chromedriver /usr/local/python/bin
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
设置python3软连接
sudo ln -s /usr/local/python/bin/python3.6 /usr/local/bin/python3
设置python3用户环境变量
cd ~
sudo vi .bash_profile
添加如下内容:
export PYTHON_HOME=/usr/local/python
export PATH=$PYTHON_HOME/bin:$PATH
source .bash_profile
sudo python3 .a.py
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。