mac安裝scrapy并創(chuàng)建項目的實例講解
最近剛好在學習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?Struct庫之pack和unpack舉例詳解
這篇文章主要給大家介紹了關(guān)于Python?Struct庫之pack和unpack的相關(guān)資料,pack和unpack在處理二進制流中比較常用的封包、解包格式,文中通過代碼介紹的非常詳細,需要的朋友可以參考下2024-02-02
Python3中編碼與解碼之Unicode與bytes的講解
今天小編就為大家分享一篇關(guān)于Python3中編碼與解碼之Unicode與bytes的講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-02-02
Python結(jié)合wxauto實現(xiàn)智能微信聊天機器人
wxauto?是我在2020年開發(fā)的一個基于?UIAutomation?的開源?Python?微信自動化庫,這篇文章主要介紹了Python結(jié)合wxauto實現(xiàn)智能微信聊天機器人,需要的朋友可以參考下2024-07-07
python openpyxl提取Excel圖片實現(xiàn)原理技巧
在這篇文章中,將介紹如何使用openpyxl來提取Excel中的圖片,以及它的原理和技巧,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2024-01-01

