本地虚拟环境开发完成之后,上线过程中需要一一安装依赖包,做个记录如下:
CentOS 安装python/266352.html">python3.5.3
wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgztar -xf Python-3.5.3.tgz cd Python-3.5.3./configure --prefix=/usr/local/python353 make & make install
完成安装python3.5.3,在不删除系统自带的python2.x情况下,做几个软链:
#做python3软链ln -s /usr/local/python353/bin/python3 /usr/local/bin/#pip3软链ln -s /usr/local/python353/bin/pip3 /usr/local/bin/
上传程序,安装scrapy及其依赖包:
#user agent包pip3 install fake-useragent -i https://pypi.douban.com/simple/#pymysql包pip3 install pymysql -i https://pypi.douban.com/simple/#PooledDB依赖包pip3 install DBUtils -i https://pypi.douban.com/simple/#PIL模块依赖包pip3 install Image -i https://pypi.douban.com/simple/
在Centos系统中安装过程中,出现一个较为淡疼的问题:系统没有安装sqlite3,故此一直提示:
解决上面问题,下载sqlite3
sudo wget http://www.sqlite.org/2017/sqlite-autoconf-3190300.tar.gz
编译安装:
tar zxvf sqlite-autoconf-3190300.tar.gz cd sqlite-autoconf-3190300./configure --prefix=/usr/local/sqlite3make && make install
重新编译Python,找到Python3.5.3的安装文件路径,编辑setup.py脚本,找到 “sqlite3”
sqlite_inc_paths = [ '/usr/include','/usr/include/sqlite','/usr/include/sqlite3','/usr/local/include','/usr/local/include/sqlite','/usr/local/include/sqlite3',]
在最后一行加入sqlite3编译安装路径,如下:
sqlite_inc_paths = [ '/usr/include','/usr/include/sqlite','/usr/include/sqlite3','/usr/local/include','/usr/local/include/sqlite','/usr/local/include/sqlite3','/usr/local/sqlite3',]
重新编译Python3.5.3:
./configure --prefix=/usr/local/python353make && make install
新闻热点
疑难解答