最近剛好在學習python+scrapy的爬蟲技術,因為mac是自帶python2.7的,所以安裝3.5版本有兩種方法,一種是升級,一種是額外安裝3.5版本。
升級就不用說了,講講額外安裝的版本吧~~~
因為python是有自帶版本的,最開始安裝的時候都會有一種“ 會不會沖突 ”的感覺。
其實安裝3.5版本也就是在官網上直接下載之后安裝,和普通的mac軟件安裝方式是一樣的~~
https://www.python.org/downloads/release/python-353/
安裝完成之后,不會覆蓋原來的python,會在 /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5文件中
在終端直接輸入 python 會執行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 則會執行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
新聞熱點
疑難解答