Scrapy already supports Python3 https://blog.scrapinghub.com/2016/02/04/python-3-support-with-scrapy-1-1rc1/
Before installing Scrapy, make sure the following are installed:
1、 Python3.5
2、 pip Python 2.7.9 and later versions include pip.
3、 lxml Most Linux versions have already installed lxml, otherwise refer to http://lxml.de/installation.html for installation.
4、 OpenSSL is pre-installed in most operating systems.
Install Python3.5 first
The ubuntu14.04 system will come with python2.7, **please do not uninstall it**. Different versions of python can coexist on the same system.
After uninstalling, the desktop system will be affected.
(1)sudo add-apt-repository ppa:fkrull/deadsnakes
(2)sudo apt-get update
(3)sudo apt-get install python3.5
(4) sudo cp /usr/bin/python /usr/bin/python_bak, first backup
(5) sudo rm /usr/bin/python, delete
(6) sudo ln -s /usr/bin/python3.5 /usr/bin/python, the default is set to python3.5, rebuild the soft link so that entering python in the terminal defaults to version 3.5.2.
Because pip, lxml and OpenSSL are pre-installed in ubuntu, you can install scrapy directly.
Install Scrapy
Don't use the python-scrapy package provided by Ubuntu, it is too old and too slow. There are two alternatives:
The first: use the official Ubuntu package, which has resolved all dependencies and continued to fix bugs.
step:
(1)Import the GPG key used to sign Scrapy packages into APT keyring:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80--recv 627220E7
(2) Use the command to create the /etc/apt/sources.list.d/scrapy.list file:
< del>echo 'deb http://archive.scrapy.org/ubuntu scrapy main'| sudo tee /etc/apt/sources.list.d/scrapy.list</del>
(3) Update the package list and install the scrapy package:
< del>sudo apt-get update && sudo apt-get install scrapy</del>
If you want to update Scrapy, repeat (3).
If you want to build Python dependencies locally without using system packages, you can use one of the following methods:
step:
(1) Install non-python dependencies
sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
(2) Installation
Recommended Posts