初識 scrapy 框架 - 安裝

前面豆子學習了基本的urllib的模塊,通過這個模塊可以寫一些簡單的爬蟲文件。如果要處理大中型的爬蟲項目,urllib就顯得比較low了,這個時候可以使用scrapy框架來實現,很多基本的處理在scrapy里面已經做好了。

首先來安裝一下。推薦的流程如下:

  1. 首先升級一下pip
C:\WINDOWS\system32>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\python36\lib\site-packages
  1. 安裝wheel
    C:\WINDOWS\system32>pip install wheel
    Requirement already satisfied: wheel in c:\python36\lib\site-packages

3.安裝lxml

C:\WINDOWS\system32>pip install lxml
Collecting lxmlDownloading lxml-4.1.1-cp36-cp36m-win32.whl (3.2MB)100% |████████████████████████████████| 3.2MB 307kB/s
Installing collected packages: lxml
Successfully installed lxml-4.1.1
  1. 安裝twisted(如果在線安裝報錯的話,可以考慮離線安裝)
    從https://www.lfd.uci.edu 上搜索twisted, 可以看見他有很多個版本

初識 scrapy 框架 - 安裝

執行一下python命令看看當前的版本,可以看見我的版本是3.6.2,32位的

c:\Users\yuan.li\Downloads>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

這樣的話可以下載對應的版本twisted-17.9.0-cp36-win32.whl就行了。
下載之后,手動安裝

c:\Users\yuan.li\Downloads>pip install Twisted-17.9.0-cp36-cp36m-win32.whl
Processing c:\users\yuan.li\downloads\twisted-17.9.0-cp36-cp36m-win32.whl
Requirement already satisfied: incremental>=16.10.1 in c:\python36\lib\site-packages (from Twisted==17.9.0)
Requirement already satisfied: Automat>=0.3.0 in c:\python36\lib\site-packages (from Twisted==17.9.0)
Requirement already satisfied: zope.interface>=4.0.2 in c:\python36\lib\site-packages (from Twisted==17.9.0)
Requirement already satisfied: hyperlink>=17.1.1 in c:\python36\lib\site-packages (from Twisted==17.9.0)
Requirement already satisfied: constantly>=15.1 in c:\python36\lib\site-packages (from Twisted==17.9.0)
Requirement already satisfied: six in c:\python36\lib\site-packages (from Automat>=0.3.0->Twisted==17.9.0)
Requirement already satisfied: attrs in c:\python36\lib\site-packages (from Automat>=0.3.0->Twisted==17.9.0)
Requirement already satisfied: setuptools in c:\python36\lib\site-packages (from zope.interface>=4.0.2->Twisted==17.9.0)
Installing collected packages: Twisted
Successfully installed Twisted-17.9.0
  1. 最后安裝scrapy
c:\Users\yuan.li\Downloads>pip install scrapy
Collecting scrapyDownloading Scrapy-1.5.0-py2.py3-none-any.whl (251kB)100% |████████████████████████████████| 256kB 2.3MB/s
Collecting pyOpenSSL (from scrapy)Downloading pyOpenSSL-17.5.0-py2.py3-none-any.whl (53kB)100% |████████████████████████████████| 61kB 4.5MB/s
Collecting cssselect>=0.9 (from scrapy)Downloading cssselect-1.0.3-py2.py3-none-any.whl
Collecting parsel>=1.1 (from scrapy)

安裝完成之后,執行一下scrapy, 看看是否工作

c:\Users\yuan.li\Downloads>scrapy
Scrapy 1.5.0 - no active projectUsage:scrapy <command> [options] [args]Available commands:bench         Run quick benchmark testfetch         Fetch a URL using the Scrapy downloadergenspider     Generate new spider using pre-defined templatesrunspider     Run a self-contained spider (without creating a project)settings      Get settings valuesshell         Interactive scraping consolestartproject  Create new projectversion       Print Scrapy versionview          Open URL in browser, as seen by Scrapy[ more ]      More commands available when run from project directory

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/278548.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278548.shtml
英文地址,請注明出處:http://en.pswp.cn/news/278548.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Vue使用Vuex一步步封裝并使用store

文章目錄一、安裝Vuex依賴二、一步步封裝store1. main.js中全局引入store倉庫&#xff08;下一步創建&#xff09;2. this.$store3. this.$store.state4. this.$store.getters&#xff08;this. $store.state的升級&#xff09;5. this.$store.commit(mutations)6. this.$store…

linux自學(四)之開始centos學習,網絡配置

上一篇&#xff1a;linux自學&#xff08;三&#xff09;之開啟虛擬機 安裝好鏡像之后&#xff0c;重啟之后需要登錄&#xff0c;我這里直接是root賬號直接登錄的&#xff0c;注意&#xff1a;輸入密碼的時候不顯示。 之后輸入ifconfig最常用的命令來查看網卡信息&#xff0c;出…

k8s extender_Windows Home Server的Drive Extender的9種選擇

k8s extenderNow that Microsoft has officially killed off the best part about Windows Home Server what can you do? Here are some alternatives for drive extender that you can use if you want to build a WHS of your own. 既然Microsoft正式取消了Windows Home Se…

為什么element的el-backtop會不管用,來看這里

<template>Scroll down to see the bottom-right button.<el-backtop target".page-component__scroll .el-scrollbar__wrap"></el-backtop> </template>把target指向你要產生“回到頂部”按鈕的組件&#xff0c; 這個組件一定要是產生滾動條…

如何創建一份springboot的docker鏡像

2019獨角獸企業重金招聘Python工程師標準>>> FROM centos:7 ENV JAVA_HOME /usr/java/jdk1.7.0_55 ENV MAC_PUBLISH_PATH /home/app ENV LOG_PATH /var/log ENV PATH $JAVA_HOME/bin:$PATH ENV TIME_ZONE Asia/Shanghai COPY jdk-7u55-linux-x64.rpm /opt/ RUN mkd…

Xamarin.Android 開發中遇到旋轉屏幕錯誤

錯誤信息 : System.NotSupportedException: Unable to find the default constructor on type App5.MyFragment. Please provide the missing constructor. 錯誤圖片&#xff1a; 解決方法&#xff1a;干脆不讓他旋轉屏幕&#xff0c;當下QQ、微信等app都沒有旋轉等功能&#…

原生js打印指定節點元素

很簡單&#xff08;可粘貼至txt文檔后改后綴為html打開看效果&#xff09;&#xff1a; <!doctype html> <html lang"en"> <head><meta charset"utf-8"><title>打印</title><meta name"viewport" conte…

Android社會化分享詳解

前言現如今app市場競爭激烈&#xff0c;做app不會放過任何推廣自己的app的渠道&#xff0c;如果app中沒有社會化分享功能&#xff0c;那真的是OUT了&#xff0c;我們先來看下一些app中的分享界面功能吧。現在主流的分享平臺&#xff0c;一般用的都是微信、QQ、微博&#xff0c;…

windows7黑屏修復_如何在Windows 10更新后修復黑屏

windows7黑屏修復RealVector/Shutterstock.comRealVector / Shutterstock.comSome Windows 10 PCs have been rebooting to a black screen after installing the June 2019 cumulative update from Windows Update. This seems scary at first, but luckily there’s a quick …

[sol]250OJ 1~10

下載 轉載于:https://www.cnblogs.com/yztblog/p/10208314.html

vue/cli4 創建vue項目選項詳解

多版本創建項目一、vue-cli2.x二、vue-cli3.x三、vue-cli4.x1.查看 vue 版本&#xff1a; 項目中,找到package.json文件夾 找"dependencies"中的vue &#xff1b; 若無項目&#xff0c;在cmd中輸入 where vue&#xff0c;cd到vue目錄下輸入 npm list vue &#xff0c…

java 商品評價計算算法

import java.io.Serializable; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.math.BigDecimal; import java.math.RoundingMode;/*** 商品評價算法* * project icomment* fileName ProductScore.java* Description* author light-z…

rainmeter使用教程_如何使用Rainmeter在桌面上顯示報價

rainmeter使用教程I’ve never really been a desktop gadgets and widgets type of person, but I often put an inspirational quote on my desktop wallpaper. Today we’ll show you how to do this using Rainmeter, no matter what wallpaper you switch to. 我從來沒有真…

Some code changes cannot be hot swapped into a running virtual machine

java運行中修改代碼不能改變立刻應用到本次運行中轉載于:https://www.cnblogs.com/Pusteblume/p/10211110.html

自定義v-drag指令(橫向拖拽滾動)

指令 Vue.directive(drag, {// 鉤子函數&#xff0c;被綁定元素插入父節點時調用 (父節點存在即可調用&#xff0c;不必存在于 document 中)。inserted: (el, binding, vnode, oldVnode) > {console.log(el, binding, vnode, oldVnode)let drag el; // 要拖拽的元素// let …

javascript獲取時間差

function GetDateDiff(startTime, endTime, diffType) {//將xxxx-xx-xx的時間格式&#xff0c;轉換為 xxxx/xx/xx的格式 startTime startTime.replace(/\-/g, "/");endTime endTime.replace(/\-/g, "/");//將計算間隔類性字符轉換為小寫diffType diffTy…

JMeter擴展JMeter插件獲取更多監聽器

為了獲取更多監聽器&#xff0c;方便的監控系統及應用&#xff0c;有必要安裝第三方插件 插件下載地址&#xff1a; https://jmeter-plugins.org/downloads/old/ http://pan.baidu.com/s/1gfC11yN 注&#xff1a;如果插件和軟件版本不兼容&#xff0c;可能在開啟Jmeter時會報錯…

如何阻止Chrome(或Edge)接管媒體密鑰

Google Chrome now has built-in support for media keys. Unfortunately, Chrome will take over your media keys and prevent them from controlling apps like Spotify when you’re watching YouTube, for example. Here’s how to make Chrome ignore your media keys. G…

js滾動條滾動到指定元素

let item document.getElementById("item"); // 指定的元素 let wrapper document.getElementById("wrapper"); // 其父元素 - 必須是產生滾動條的元素// 元素聚焦法定位 // item.focus(); // 可用 outline:none; 除去聚焦產生的框; 對于默認沒有聚焦的…

開源性能測試工具JMeter快速入門(一)

目錄一、JMeter簡介二、JMeter功能介紹三、JMeter腳本四、關于JMeter小提示一、JMeter簡介1.定義JMeter是Apache組織開發的基于Java的壓力測試工具。用于對軟件做壓力測試&#xff0c;它最初被設計用于Web應用測試&#xff0c;但后來擴展到其他測試領域。 1&#xff09;它可以用…