搭建vps百度云中转站

搭建步骤

  1. 使用 vutlr 搭建的 vps 服务器,操作系统选用的 centos6。在 centos6 中默认有 python 的,而 python 的版本大部分情况下 2.6,也有 2.7 版本的。如果是 2.7 的,将会省去了升级 phython 版本这一大步。需要升级看后面。
  2. 进入系统,输入 python -v 查看版本,如果是 2.7 以上,进行下一步。
  3. 下载最新版的pip,然后安装查看。
//下载
# wget https://bootstrap.pypa.io/get-pip.py
//安装
# python get-pip.py
//查看
# whereis pip
  1. 使用 pip 安装 bypy
# pip2.7 install bypy
  1. 这样就安装好 linux 下的百度网盘 Python 客户端

    如果安装报错:

    
    [root@hwsrv-485269 /]# pip2.7 install bypy
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Collecting bypy
      Using cached https://files.pythonhosted.org/packages/ed/e1/45cc5a7902a723926f00662d5592d1cb2e6fbbaabf27f0122ab02b303326/bypy-1.6.6-py2.py3-none-any.whl
    Collecting requests>=2.10.0
      Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
    Processing /root/.cache/pip/wheels/96/20/ac/9f1d164f7d81787cd6f4401b1d05212807d021fbbbcc301b82/multiprocess-0.70.9-cp27-none-any.whl
    Collecting requests-toolbelt>=0.8.0
      Using cached https://files.pythonhosted.org/packages/60/ef/7681134338fc097acef8d9b2f8abe0458e4d87559c689a8c306d0957ece5/requests_toolbelt-0.9.1-py2.py3-none-any.whl
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests>=2.10.0->bypy) (3.0.4)
    Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python2.7/site-packages (from requests>=2.10.0->bypy) (2.8)
    Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests>=2.10.0->bypy) (1.25.7)
    Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests>=2.10.0->bypy) (2019.11.28)
    Processing /root/.cache/pip/wheels/59/b1/91/f02e76c732915c4015ab4010f3015469866c1eb9b14058d8e7/dill-0.3.1.1-cp27-none-any.whl
    Installing collected packages: requests, dill, multiprocess, requests-toolbelt, bypy
      Found existing installation: requests 2.6.0
    ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
    

    使用以下命令即可:

    
    pip2.7 install bypy --ignore-installed requests

    第一次使用要进行验证授权,如下:
#bypy info
Please visit:
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done
用浏览器打开链接,将验证码输入后回车,即可完成授权,对应网盘目录
百度网盘-->我的应用数据-->bypy

其它用法,如下
更详细的了解某一个命令:

#bypy help <command>
显示在云盘(程序的)根目录下文件列表:
#bypy list
把当前目录同步到云盘:
#bypy syncup  
或者
#bypy upload
把云盘内容同步到本地来:
#bypy syncdown
或者
#bypy downdir /
比较本地当前目录和云盘(程序的)根目录(个人认为非常有用):
#bypy compare

升级 Python 及升级时可能遇到的报错:

  1. 升级 python
centos 6.5python 版本为 2.6 的,这里我们先要安装 python2.7
1、安装 sqlite-devel
#yum install sqlite-devel -y
2、安装 Python 2.7
#wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
#tar xf Python-2.7.8.tgz
#cd Python-2.7.8
#./configure --prefix=/usr/local
#make && make install
3、然后继续文章前面的步骤
  1. #./configure --prefix=/usr/local此处报错,缺少gcc,解决方法
yum -y install gcc-c++

参照链接

  1. http://www.h3399.cn/201705/84012.html
  2. http://wooyaa.me/archives/Update-python

发表回复

您的电子邮箱地址不会被公开。