如何在云linux上安装和cron python3 Scrapy

时间:2016-09-07 15:54:06

标签: python linux centos scrapy pip

我有一个用python 3编写的Scrapy蜘蛛,我想在我的云Linux服务器上运行它作为一个cron作业(我有root访问权限) 首先,我无法使用pip3 install scrapy进行安装,我遇到了:

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/tarfile.py", line 1642, in bz2open
    import bz2
  File "/usr/local/lib/python3.4/bz2.py", line 20, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ImportError: No module named '_bz2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python3.4/site-packages/pip/req.py", line 1197, in prepare_files
    do_download,
  File "/usr/local/lib/python3.4/site-packages/pip/req.py", line 1375, in unpack_url
    self.session,
  File "/usr/local/lib/python3.4/site-packages/pip/download.py", line 582, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "/usr/local/lib/python3.4/site-packages/pip/util.py", line 625, in unpack_file
    untar_file(filename, location)
  File "/usr/local/lib/python3.4/site-packages/pip/util.py", line 543, in untar_file
    tar = tarfile.open(filename, mode)
  File "/usr/local/lib/python3.4/tarfile.py", line 1567, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/local/lib/python3.4/tarfile.py", line 1644, in bz2open
    raise CompressionError("bz2 module is not available")
tarfile.CompressionError: bz2 module is not available

然后如何将其作为cron作业运行?

0 个答案:

没有答案