- 1.安装python3 依赖:
apt install -y python3-pip git python3
- 2.下载源码:
cd
git clone https://github.com/lzdnico/Collection-of-Translation.git
- 3.安装库:
cd Collection-of-Translation
pip3 install -I -r requirements.txt
- 4.安装PhantomJS:
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
cp -R phantomjs-2.1.1-linux-x86_64 /usr/local/share/
ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
- 5.后台运行:
python3 api.py
- 6.速度太慢?申请百度API和有道API:
修改api/apikey.py 下的翻译API_Key
修改api/trans.py translate()函数的的调用方式