python中安装Scrapy模块依赖包汇总

python中安装Scrapy模块依赖包汇总,第1张

python中安装Scrapy模块依赖包汇总

本地虚拟环境开发完成之后,上线过程中需要一一安装依赖包,做个记录如下:

CentOS 安装python3.5.3

wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
tar -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/sqlite3
make && 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/python353
make && make install

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3313351.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-10-06
下一篇 2022-10-06

发表评论

登录后才能评论

评论列表(0条)

保存