elementary os 5.0(基于ubuntu18.04) 安装scrapy

安装pip
sudo apt install python-pip

升级pip
pip install pip -U

升级过程之后可能出错,错误信息如下:
   ImportError: cannot import name main

修复错误:
sudo gedit /usr/bin/pip

将原始的:
  from pip import main
变更为:
  from pip._internal import main  

配置国内镜像:
清华:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

安装scrapy相关依赖:
sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev

如果想安装在python3上:
sudo apt-get install python3 python3-dev

安装scrapy:(我前面没加sudo报了个权限错误)
sudo pip install scrapy

你可能感兴趣的:(elementary os 5.0(基于ubuntu18.04) 安装scrapy)