mac安裝scrapy并創(chuàng)建項目的實例講解
最近剛好在學(xué)習(xí)python+scrapy的爬蟲技術(shù),因為mac是自帶python2.7的,所以安裝3.5版本有兩種方法,一種是升級,一種是額外安裝3.5版本。
升級就不用說了,講講額外安裝的版本吧~~~
因為python是有自帶版本的,最開始安裝的時候都會有一種“ 會不會沖突 ”的感覺。
其實安裝3.5版本也就是在官網(wǎng)上直接下載之后安裝,和普通的mac軟件安裝方式是一樣的~~
https://www.python.org/downloads/release/python-353/
安裝完成之后,不會覆蓋原來的python,會在 /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5文件中
在終端直接輸入 python 會執(zhí)行python2.7版本
python Python 2.7.12 (default, Jun 29 2016, 14:05:02) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
在終端直接輸入 python3 則會執(zhí)行python3.5版本
python3 Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 08:49:46) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
接下來就可以開始安裝scrapy了
python3.5中會自帶 pip,所以不需要額外安裝了,可以直接在終端輸入 pip3 --version查看版本和路徑
pip3 --version pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
使用 pip3 安裝scrapy
pip3 install Scrapy
這里的Scrapy一定要首字母大寫,不然會在安裝的過程中報錯~~
Collecting scrapy Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2c88>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/ Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa29e8>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/ Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2630>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/ Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2f28>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/ Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2be0>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/ Could not find a version that satisfies the requirement scrapy (from versions: ) No matching distribution found for scrapy
安裝成功之后,可以直接在終端上輸入 scrapy 查看版本號及使用
Scrapy 1.4.0 - no active project Usage: scrapy <command> [options] [args] Available commands: bench Run quick benchmark test fetch Fetch a URL using the Scrapy downloader genspider Generate new spider using pre-defined templates runspider Run a self-contained spider (without creating a project) settings Get settings values shell Interactive scraping console startproject Create new project version Print Scrapy version view Open URL in browser, as seen by Scrapy [ more ] More commands available when run from project directory Use "scrapy <command> -h" to see more info about a command
在pycharm中是沒有直接創(chuàng)建scrapy項目的,可以使用 scrapy 命令手動新建項目
scrapy startproject ArticleSpider(ArticleSpider為項目名稱)
以上這篇mac安裝scrapy并創(chuàng)建項目的實例講解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
python之Django自動化資產(chǎn)掃描的實現(xiàn)
這篇文章主要介紹了python之Django自動化資產(chǎn)掃描的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04python lambda表達(dá)式在sort函數(shù)中的使用詳解
這篇文章主要介紹了python lambda表達(dá)式在sort函數(shù)中的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-08-08狀態(tài)機(jī)的概念和在Python下使用狀態(tài)機(jī)的教程
這篇文章主要介紹了狀態(tài)機(jī)的概念和在Python下使用狀態(tài)機(jī)的教程,本文來自于IBM官方開發(fā)者技術(shù)文檔,需要的朋友可以參考下2015-04-04python3文件復(fù)制、延遲文件復(fù)制任務(wù)的實現(xiàn)方法
這篇文章主要給大家介紹了關(guān)于python3文件復(fù)制、延遲文件復(fù)制任務(wù)的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用python3具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09Python3爬蟲里關(guān)于代理的設(shè)置總結(jié)
在本篇文章里小編給大家整理的是一篇關(guān)于Python3爬蟲里關(guān)于代理的設(shè)置總結(jié),需要的朋友們可以參考下。2020-07-07Tensorflow2.10使用BERT從文本中抽取答案實現(xiàn)詳解
這篇文章主要為大家介紹了Tensorflow2.10使用BERT從文本中抽取答案實現(xiàn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-04-04用Python的Django框架完成視頻處理任務(wù)的教程
這篇文章主要介紹了用Python的Django框架完成視頻處理任務(wù)的教程,包括用戶的視頻上傳和播放以及下載功能的實現(xiàn),需要的朋友可以參考下2015-04-04