12306 github project deployment

Some deployment environment pit, step on once is enough. . .

Address original project

安装 requirements.txt


推荐 anaconda 进行包管理, conda  create -n py36 然后 配置一下 环境变量 一顿 安装
/home/ml/anaconda3/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

Download chrome and chrome driver

1、安装chrome

用下面的命令安装最新的 Google Chrome

yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
也可以下载到本地再安装
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum install ./google-chrome-stable_current_x86_64.rpm
 

安装必要的库
yum install mesa-libOSMesa-devel gnu-free-sans-fonts wqy-zenhei-fonts
 

2、安装 chromedriver

chrome官网 wget https://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip
淘宝源(推荐)wget http://npm.taobao.org/mirrors/chromedriver/2.41/chromedriver_linux64.zip
 

 
将下载的文件解压,放在如下位置

unzip chromedriver_linux64.zip

/usr/bin/chromedriver

给予执行权限

chmod +x /usr/bin/chromedriver

Set chrome driver parameter information

grep -r 'webdriver'
vim config/getCookie.py



options = Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')
其中
“–no-sandbox”参数是让Chrome在root权限下跑
“–headless”参数是不用打开图形界面
可以额外加这些参数获得更好体验

其中
“–no-sandbox”参数是让Chrome在root权限下跑
“–headless”参数是不用打开图形界面
可以额外加这些参数获得更好体验

options.add_argument('blink-settings=imagesEnabled=false')
options.add_argument('--disable-gpu')

Synchronized time and change the time zone

sudo ntpdate -u 210.72.145.44

sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime

Placed prediction model file

cp 12306models/xxx.h5   12306/

Guess you like

Origin www.cnblogs.com/Frank99/p/11493262.html