Mac中Python 3环境下安装scrapy的方法教程

前言

最近抽空想学习一下python的爬虫框架scrapy,在mac下安装的时候遇到了问题,逐一解决了问题,分享一下,话不多说了,来一起看看详细的介绍吧。

步骤如下:

1. 从官网 下载最新版本Python 3.6.3(本地快速下载安装:http://www.jb51.net/softs/583651.html)

# 在Mac上Python3环境下安装scrapy

2. 安装 Python3

在终端输入python3出现下面的内容表示安装成功

➜ ~ python3
Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

输入quit()退出编辑模式

3. 输入 pip install scrapy 执行 scrapy 安装

➜ ~ pip install Scrapy
Collecting Scrapy
 Using cached Scrapy-1.4.0-py2.py3-none-any.whl
Collecting lxml (from Scrapy)
 Using cached lxml-4.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting PyDispatcher>=2.0.5 (from Scrapy)
 Using cached PyDispatcher-2.0.5.tar.gz
Collecting Twisted>=13.1.0 (from Scrapy)
 Using cached Twisted-17.9.0.tar.bz2
Requirement already satisfied: pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Scrapy)
Collecting queuelib (from Scrapy)
 Using cached queuelib-1.4.2-py2.py3-none-any.whl
Collecting cssselect>=0.9 (from Scrapy)
 Using cached cssselect-1.0.1-py2.py3-none-any.whl
Collecting parsel>=1.1 (from Scrapy)
 Using cached parsel-1.2.0-py2.py3-none-any.whl
Collecting service-identity (from Scrapy)
 Using cached service_identity-17.0.0-py2.py3-none-any.whl
Collecting six>=1.5.2 (from Scrapy)
 Using cached six-1.11.0-py2.py3-none-any.whl
Collecting w3lib>=1.17.0 (from Scrapy)
 Using cached w3lib-1.18.0-py2.py3-none-any.whl
Requirement already satisfied: zope.interface>=3.6.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Twisted>=13.1.0->Scrapy)
Collecting constantly>=15.1 (from Twisted>=13.1.0->Scrapy)
 Using cached constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted>=13.1.0->Scrapy)
 Using cached incremental-17.5.0-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from Twisted>=13.1.0->Scrapy)
 Using cached Automat-0.6.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from Twisted>=13.1.0->Scrapy)
 Using cached hyperlink-17.3.1-py2.py3-none-any.whl
Collecting pyasn1 (from service-identity->Scrapy)
 Using cached pyasn1-0.3.7-py2.py3-none-any.whl
Collecting pyasn1-modules (from service-identity->Scrapy)
 Using cached pyasn1_modules-0.1.5-py2.py3-none-any.whl
Collecting attrs (from service-identity->Scrapy)
 Using cached attrs-17.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from zope.interface>=3.6.0->Twisted>=13.1.0->Scrapy)
Installing collected packages: lxml, PyDispatcher, constantly, incremental, six, attrs, Automat, hyperlink, Twisted, queuelib, cssselect, w3lib, parsel, pyasn1, pyasn1-modules, service-identity, Scrapy
Exception:
Traceback (most recent call last):
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
 status = self.run(options, args)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
 prefix=options.prefix_path,
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
 **kwargs
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
 self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
 isolated=self.isolated,
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
 clobber(source, lib_dir, True)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
 ensure_dir(destdir)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
 os.makedirs(path)
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
 mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/lxml'

出现 OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/lxml' 错误

4. 尝试重新安装lxml,执行 sudo pip install lxml

➜ ~ sudo pip install lxml
The directory '/Users/wangruofeng/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wangruofeng/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lxml
 Downloading lxml-4.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (8.7MB)
 100% |████████████████████████████████| 8.7MB 97kB/s
Installing collected packages: lxml
Successfully installed lxml-4.1.0
➜ ~ sudo pip install scrapy
The directory '/Users/wangruofeng/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wangruofeng/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting scrapy
 Downloading Scrapy-1.4.0-py2.py3-none-any.whl (248kB)
 100% |████████████████████████████████| 256kB 1.5MB/s
Requirement already satisfied: lxml in /Library/Python/2.7/site-packages (from scrapy)
Collecting PyDispatcher>=2.0.5 (from scrapy)
 Downloading PyDispatcher-2.0.5.tar.gz
Collecting Twisted>=13.1.0 (from scrapy)
 Downloading Twisted-17.9.0.tar.bz2 (3.0MB)
 100% |████████████████████████████████| 3.0MB 371kB/s
Requirement already satisfied: pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy)
Collecting queuelib (from scrapy)
 Downloading queuelib-1.4.2-py2.py3-none-any.whl
Collecting cssselect>=0.9 (from scrapy)
 Downloading cssselect-1.0.1-py2.py3-none-any.whl
Collecting parsel>=1.1 (from scrapy)
 Downloading parsel-1.2.0-py2.py3-none-any.whl
Collecting service-identity (from scrapy)
 Downloading service_identity-17.0.0-py2.py3-none-any.whl
Collecting six>=1.5.2 (from scrapy)
 Downloading six-1.11.0-py2.py3-none-any.whl
Collecting w3lib>=1.17.0 (from scrapy)
 Downloading w3lib-1.18.0-py2.py3-none-any.whl
Requirement already satisfied: zope.interface>=3.6.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Twisted>=13.1.0->scrapy)
Collecting constantly>=15.1 (from Twisted>=13.1.0->scrapy)
 Downloading constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted>=13.1.0->scrapy)
 Downloading incremental-17.5.0-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from Twisted>=13.1.0->scrapy)
 Downloading Automat-0.6.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from Twisted>=13.1.0->scrapy)
 Downloading hyperlink-17.3.1-py2.py3-none-any.whl (73kB)
 100% |████████████████████████████████| 81kB 1.4MB/s
Collecting pyasn1 (from service-identity->scrapy)
 Downloading pyasn1-0.3.7-py2.py3-none-any.whl (63kB)
 100% |████████████████████████████████| 71kB 2.8MB/s
Collecting pyasn1-modules (from service-identity->scrapy)
 Downloading pyasn1_modules-0.1.5-py2.py3-none-any.whl (60kB)
 100% |████████████████████████████████| 61kB 2.5MB/s
Collecting attrs (from service-identity->scrapy)
 Downloading attrs-17.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from zope.interface>=3.6.0->Twisted>=13.1.0->scrapy)
Installing collected packages: PyDispatcher, constantly, incremental, six, attrs, Automat, hyperlink, Twisted, queuelib, cssselect, w3lib, parsel, pyasn1, pyasn1-modules, service-identity, scrapy
 Running setup.py install for PyDispatcher ... done
 Found existing installation: six 1.4.1
 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
 Uninstalling six-1.4.1:
 Successfully uninstalled six-1.4.1
 Running setup.py install for Twisted ... done
Successfully installed Automat-0.6.0 PyDispatcher-2.0.5 Twisted-17.9.0 attrs-17.2.0 constantly-15.1.0 cssselect-1.0.1 hyperlink-17.3.1 incremental-17.5.0 parsel-1.2.0 pyasn1-0.3.7 pyasn1-modules-0.1.5 queuelib-1.4.2 scrapy-1.4.0 service-identity-17.0.0 six-1.11.0 w3lib-1.18.0

成功安装lxml-4.1.0

5. 再次尝试安装scrapy,执行 sudo pip install scrapy

➜ ~ sudo pip install scrapy
The directory '/Users/wangruofeng/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wangruofeng/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting scrapy
 Downloading Scrapy-1.4.0-py2.py3-none-any.whl (248kB)
 100% |████████████████████████████████| 256kB 1.5MB/s
Requirement already satisfied: lxml in /Library/Python/2.7/site-packages (from scrapy)
Collecting PyDispatcher>=2.0.5 (from scrapy)
 Downloading PyDispatcher-2.0.5.tar.gz
Collecting Twisted>=13.1.0 (from scrapy)
 Downloading Twisted-17.9.0.tar.bz2 (3.0MB)
 100% |████████████████████████████████| 3.0MB 371kB/s
Requirement already satisfied: pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy)
Collecting queuelib (from scrapy)
 Downloading queuelib-1.4.2-py2.py3-none-any.whl
Collecting cssselect>=0.9 (from scrapy)
 Downloading cssselect-1.0.1-py2.py3-none-any.whl
Collecting parsel>=1.1 (from scrapy)
 Downloading parsel-1.2.0-py2.py3-none-any.whl
Collecting service-identity (from scrapy)
 Downloading service_identity-17.0.0-py2.py3-none-any.whl
Collecting six>=1.5.2 (from scrapy)
 Downloading six-1.11.0-py2.py3-none-any.whl
Collecting w3lib>=1.17.0 (from scrapy)
 Downloading w3lib-1.18.0-py2.py3-none-any.whl
Requirement already satisfied: zope.interface>=3.6.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Twisted>=13.1.0->scrapy)
Collecting constantly>=15.1 (from Twisted>=13.1.0->scrapy)
 Downloading constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted>=13.1.0->scrapy)
 Downloading incremental-17.5.0-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from Twisted>=13.1.0->scrapy)
 Downloading Automat-0.6.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from Twisted>=13.1.0->scrapy)
 Downloading hyperlink-17.3.1-py2.py3-none-any.whl (73kB)
 100% |████████████████████████████████| 81kB 1.4MB/s
Collecting pyasn1 (from service-identity->scrapy)
 Downloading pyasn1-0.3.7-py2.py3-none-any.whl (63kB)
 100% |████████████████████████████████| 71kB 2.8MB/s
Collecting pyasn1-modules (from service-identity->scrapy)
 Downloading pyasn1_modules-0.1.5-py2.py3-none-any.whl (60kB)
 100% |████████████████████████████████| 61kB 2.5MB/s
Collecting attrs (from service-identity->scrapy)
 Downloading attrs-17.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from zope.interface>=3.6.0->Twisted>=13.1.0->scrapy)
Installing collected packages: PyDispatcher, constantly, incremental, six, attrs, Automat, hyperlink, Twisted, queuelib, cssselect, w3lib, parsel, pyasn1, pyasn1-modules, service-identity, scrapy
 Running setup.py install for PyDispatcher ... done
 Found existing installation: six 1.4.1
 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
 Uninstalling six-1.4.1:
 Successfully uninstalled six-1.4.1
 Running setup.py install for Twisted ... done
Successfully installed Automat-0.6.0 PyDispatcher-2.0.5 Twisted-17.9.0 attrs-17.2.0 constantly-15.1.0 cssselect-1.0.1 hyperlink-17.3.1 incremental-17.5.0 parsel-1.2.0 pyasn1-0.3.7 pyasn1-modules-0.1.5 queuelib-1.4.2 scrapy-1.4.0 service-identity-17.0.0 six-1.11.0 w3lib-1.18.0

6. 执行 scrapy 出现下面错误

➜ ~ scrapy
Traceback (most recent call last):
 File "/usr/local/bin/scrapy", line 7, in <module>
 from scrapy.cmdline import execute
 File "/Library/Python/2.7/site-packages/scrapy/cmdline.py", line 9, in <module>
 from scrapy.crawler import CrawlerProcess
 File "/Library/Python/2.7/site-packages/scrapy/crawler.py", line 7, in <module>
 from twisted.internet import reactor, defer
 File "/Library/Python/2.7/site-packages/twisted/internet/reactor.py", line 38, in <module>
 from twisted.internet import default
 File "/Library/Python/2.7/site-packages/twisted/internet/default.py", line 56, in <module>
 install = _getInstallFunction(platform)
 File "/Library/Python/2.7/site-packages/twisted/internet/default.py", line 50, in _getInstallFunction
 from twisted.internet.selectreactor import install
 File "/Library/Python/2.7/site-packages/twisted/internet/selectreactor.py", line 18, in <module>
 from twisted.internet import posixbase
 File "/Library/Python/2.7/site-packages/twisted/internet/posixbase.py", line 18, in <module>
 from twisted.internet import error, udp, tcp
 File "/Library/Python/2.7/site-packages/twisted/internet/tcp.py", line 28, in <module>
 from twisted.internet._newtls import (
 File "/Library/Python/2.7/site-packages/twisted/internet/_newtls.py", line 21, in <module>
 from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
 File "/Library/Python/2.7/site-packages/twisted/protocols/tls.py", line 63, in <module>
 from twisted.internet._sslverify import _setAcceptableProtocols
 File "/Library/Python/2.7/site-packages/twisted/internet/_sslverify.py", line 38, in <module>
 TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'

需要更新 OpenSSL 库,执行 sudo pip install --upgrade pyopenssl

➜ ~ sudo pip install --upgrade pyopenssl
Password:
The directory '/Users/wangruofeng/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wangruofeng/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pyopenssl
 Downloading pyOpenSSL-17.3.0-py2.py3-none-any.whl (51kB)
 100% |████████████████████████████████| 51kB 132kB/s
Requirement already up-to-date: six>=1.5.2 in /Library/Python/2.7/site-packages (from pyopenssl)
Collecting cryptography>=1.9 (from pyopenssl)
 Downloading cryptography-2.1.1-cp27-cp27m-macosx_10_6_intel.whl (1.5MB)
 100% |████████████████████████████████| 1.5MB 938kB/s
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=1.9->pyopenssl)
 Downloading cffi-1.11.2-cp27-cp27m-macosx_10_6_intel.whl (238kB)
 100% |████████████████████████████████| 245kB 2.2MB/s
Collecting enum34; python_version < "3" (from cryptography>=1.9->pyopenssl)
 Downloading enum34-1.1.6-py2-none-any.whl
Collecting idna>=2.1 (from cryptography>=1.9->pyopenssl)
 Downloading idna-2.6-py2.py3-none-any.whl (56kB)
 100% |████████████████████████████████| 61kB 3.1MB/s
Collecting asn1crypto>=0.21.0 (from cryptography>=1.9->pyopenssl)
 Downloading asn1crypto-0.23.0-py2.py3-none-any.whl (99kB)
 100% |████████████████████████████████| 102kB 2.7MB/s
Collecting ipaddress; python_version < "3" (from cryptography>=1.9->pyopenssl)
 Downloading ipaddress-1.0.18-py2-none-any.whl
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.9->pyopenssl)
 Downloading pycparser-2.18.tar.gz (245kB)
 100% |████████████████████████████████| 256kB 3.6MB/s
Installing collected packages: pycparser, cffi, enum34, idna, asn1crypto, ipaddress, cryptography, pyopenssl
 Running setup.py install for pycparser ... done
 Found existing installation: pyOpenSSL 0.13.1
 DEPRECATION: Uninstalling a distutils installed project (pyopenssl) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
 Uninstalling pyOpenSSL-0.13.1:
 Successfully uninstalled pyOpenSSL-0.13.1
Successfully installed asn1crypto-0.23.0 cffi-1.11.2 cryptography-2.1.1 enum34-1.1.6 idna-2.6 ipaddress-1.0.18 pycparser-2.18 pyopenssl-17.3.0

更新 OpenSSL 成功,再次尝试执行 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

出现上面内容,表明安装成功。现在可以通过 scrapy 创建一个爬虫项目了

7. 进入到你项目的目录,执行 scrapy startproject firstscrapy创建 firstscrapy 爬虫项目

➜ PycharmProjects scrapy startproject firstscrapy
New Scrapy project 'firstscrapy', using template directory '/Library/Python/2.7/site-packages/scrapy/templates/project', created in:
 /Users/wangruofeng/PycharmProjects/firstscrapy

You can start your first spider with:
 cd firstscrapy
 scrapy genspider example example.com
➜ PycharmProjects

出现上面内容表明项目创建成功,但是使用的是2.7版本的Python怎么切换到3.6版本呢?

8. 使用 PyCharm IDE 打开刚才的项目,执行 command + , 打开偏好设置菜单,在Project里面选择 Projiect interpreter 来切换你需要依赖的Python库的版本,配置结束。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对我们的支持。

(0)

相关推荐

  • windows10系统中安装python3.x+scrapy教程

    官网下载就好, https://www.python.org/downloads/release/python-352/ 用installer下载比较方便,它直接把环境变量都帮你配了. 当然也可以在本站下载 http://www.jb51.net/softs/416037.html 升级pip 安装好之后在cmd里执行 python -m pip install -upgrade pip 把pip提到最新版本 下载lxml lxml是解析网页用的,scrapy依赖于它,它是一个第三方的库,这里推

  • python中安装Scrapy模块依赖包汇总

    本地虚拟环境开发完成之后,上线过程中需要一一安装依赖包,做个记录如下: CentOS 安装python3.5.3 wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz tar -xf Python-3.5.3.tgz cd Python-3.5.3 ./configure --prefix=/usr/local/python353 make & make install 完成安装python3.5.3,在不删除系统自带的pyt

  • Python爬虫框架Scrapy安装使用步骤

    一.爬虫框架Scarpy简介Scrapy 是一个快速的高层次的屏幕抓取和网页爬虫框架,爬取网站,从网站页面得到结构化的数据,它有着广泛的用途,从数据挖掘到监测和自动测试,Scrapy完全用Python实现,完全开源,代码托管在Github上,可运行在Linux,Windows,Mac和BSD平台上,基于Twisted的异步网络库来处理网络通讯,用户只需要定制开发几个模块就可以轻松的实现一个爬虫,用来抓取网页内容以及各种图片. 二.Scrapy安装指南 我们的安装步骤假设你已经安装一下内容:<1>

  • 零基础写python爬虫之爬虫框架Scrapy安装配置

    前面十章爬虫笔记陆陆续续记录了一些简单的Python爬虫知识, 用来解决简单的贴吧下载,绩点运算自然不在话下. 不过要想批量下载大量的内容,比如知乎的所有的问答,那便显得游刃不有余了点. 于是乎,爬虫框架Scrapy就这样出场了! Scrapy = Scrach+Python,Scrach这个单词是抓取的意思, Scrapy的官网地址:点我点我. 那么下面来简单的演示一下Scrapy的安装流程. 具体流程参照:http://www.jb51.net/article/48607.htm 友情提醒:

  • python安装Scrapy图文教程

    安装方法 pip install Scrapy 如果顺利的话不用管直接一路下来就OK 验证是否安装成功 安装成功 不顺利的情况 1)lxml安装不成功 使用whl进行安装,不过需要先安装whl pip install wheel 安装完成后下载lxml的whl文件 网址: http://www.lfd.uci.edu/~gohlke/pythonlibs/ whl版本挑选 进入cmd-->import pip-->print pip.pep425tags.get_supported(),按照截

  • 在Linux系统上安装Python的Scrapy框架的教程

    这是一款提取网站数据的开源工具.Scrapy框架用Python开发而成,它使抓取工作又快又简单,且可扩展.我们已经在virtual box中创建一台虚拟机(VM)并且在上面安装了Ubuntu 14.04 LTS. 安装 Scrapy Scrapy依赖于Python.开发库和pip.Python最新的版本已经在Ubuntu上预装了.因此我们在安装Scrapy之前只需安装pip和python开发库就可以了. pip是作为python包索引器easy_install的替代品,用于安装和管理Python

  • Mac中Python 3环境下安装scrapy的方法教程

    前言 最近抽空想学习一下python的爬虫框架scrapy,在mac下安装的时候遇到了问题,逐一解决了问题,分享一下,话不多说了,来一起看看详细的介绍吧. 步骤如下: 1. 从官网 下载最新版本Python 3.6.3(本地快速下载安装:http://www.jb51.net/softs/583651.html) # 在Mac上Python3环境下安装scrapy 2. 安装 Python3 在终端输入python3出现下面的内容表示安装成功 ➜ ~ python3 Python 3.6.3 (

  • CentOS环境下安装PHPUnit的方法分析

    本文实例讲述了CentOS环境下安装PHPUnit的方法.分享给大家供大家参考,具体如下: PHPUnit之于PHP正如JUnit之于Java,是PHP程序员用来写单元测试代码的工具.由于上级要求员工写代码时也要写单元测试代码,于是我在网上搜集相关资料,并整理了一套符合自己虚拟机环境的PHPUnit安装方法. 要求: 系统:centos5.4 PHP版本:php5.3. 一.安装Pear 首先要安装最新的pear.安装命令如下: wget http://pear.php.net/go-pear.

  • Python2.7下安装Scrapy框架步骤教程

    由于毕业设计的要求,需要在网站上抓取大量的数据,那么使用Scrapy框架可以让这一过程变得简单不少,毕竟Scrapy是一个为了爬去网站数据.提取结构性数据而编写的应用框架.于是,便开始了我的安装Scrapy框架之旅.可以说这个过程并不是很愉快,各种错误各种出,不过到最后,终于安装上了Scrapy框架.下面总结一下我的Scrapy框架的安装. 1.安装python2.7 由于Scrapy不支持Python3.0,于是我卸载了Python3.0,又重新安装了Python2.7(python2.7安装

  • 在Mac OS的PHP环境下安装配置MemCache的全过程解析

    安装服务端 memcache是项目名,而在服务端的驻留进程叫memcached(linux的守护进程一般都是在后面加个d).在OSX下使用brew可以快速安装memcache: $ sudo brew install memcached memcache的依赖:openssl和libevent会自动下载并安装. 安装完成后,使用如下命令启动: $ sudo memcached -m 32 -p 11211 -d 安装php扩展 使用php操作memcache前,需要安装php的扩展,php的扩展

  • Python3中在Anaconda环境下安装basemap包

    Basemap是matplotlib子包,也是python中最常用.最方便的地理数据可视化工具之一. 在中端输入pip list先查看是否有jupyter,一般安装了Anaconda都会有. win+R 打开命令提示符窗口,cd命令将当前目录设置为下载文件存放的文件夹(我放在桌面)后点回车键. basemap下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/ (1) 在终端输入python可以查看自己需要哪个版本的. (2)basemap 将文件下载

  • 在MAMP环境下安装MySQLdb的方法

    我的电脑上没有安装XAMPP,而是安装了MAMP PRO,其实两者都差不多,都是PHP+MySQL+Apache的集成环境,只是MAMP的GUI界面更华丽一些,但是也更复杂一些. 好了不说这些,说说问题吧.首先我使用如下命令来安装MySQLdb: pip install mysql-python但是错误提示,找不到mysql_config文件. 这个好办,找到这个文件添加到PATH路径下即可. find /Applications/MAMP -name mysql_config可以得到路径是:/

  • python mac下安装虚拟环境的图文教程

    Mac 下 Flask 框架 workon命令找不到 ---- 最终解决方案(详解具体实现操作过程中遇到的坑)2018年08月17日 00:02:05Jasonmes阅读数:622 Mac 下 Flask 的 全网最详细搭建1.安装virtualenv和virtualenvwrapper sudo pip install virtualenv# 以下成功截图 sudo pip install virtualenvwrapper# 以下成功截图 创建存放虚拟环境的文件夹并切换到该文件夹下 mkdi

  • ubuntu服务器环境下安装python的方法

    本文实例讲述了ubuntu服务器环境下安装python的方法.分享给大家供大家参考,具体如下: ubuntu 14.04 --16.04 版本默认是安装的是python 2.7 1.查看当前python版本 $python --version 2.升级到python3.X版本 $sudo add-apt-repository ppa:fkrull/deadsnakes#添加一个源 $sudo apt-get update#更新源列表,以获取最新的版本 $sudo apt-get install

  • linux环境下安装python虚拟环境及注意事项

    创建python虚拟环境virtualenv.virtualenvwrapper 1,为什么需要搭建虚拟环境 由于当机器上两个项目依赖于相同包的不同版本时,会导致项目运行失败,此时可以安装虚拟环境 . 2,什么是虚拟环境 虚拟环境就是python环境的复制版本 创建虚拟环境时需要有网络连接 3,安装python.pip.virtualenv ubuntu: sudo apt-get install python3 # 安装python3 sudo apt-get install python-p

  • python环境下安装opencv库的方法

    注意:安装opencv之前需要先安装numpy,matplotlib等 一.安装方法 方法一.在线安装 1.先安装opencv-python pip install opencv-python --user 我的python版本是3.6.8,可以看到opencv安装的默认版本是 opencv_python-4.1.0.25-cp36-cp36m-win_amd64.whl 2.再安装opencv-contrib-python pip install opencv-contrib-python -

随机推荐