mac系统 pip3 install scrapy 失败 No local packages or working download links found for incremental>=16.10.1

使用pip3 install scrapy命令之后,会出现如下问题:

 

Collecting scrapy

  Downloading Scrapy-1.4.0-py2.py3-none-any.whl (248kB)

    100% |████████████████████████████████| 256kB 1.2MB/s 

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 323kB/s 

    Complete output from command python setup.py egg_info:

    Download error on https://pypi.python.org/simple/incremental/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) -- Some packages may not be found!

    Couldn't find index page for 'incremental' (maybe misspelled?)

    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) -- Some packages may not be found!

    No local packages or working download links found for incremental>=16.10.1

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "/private/var/folders/z5/9myf58gd0q5cj6hh8pnsfm800000gn/T/pip-build-do6a4sxu/Twisted/setup.py", line 21, in <module>

        setuptools.setup(**_setup["getSetupArgs"]())

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup

        _setup_distribution = dist = klass(attrs)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/dist.py", line 315, in __init__

        self.fetch_build_eggs(attrs['setup_requires'])

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs

        replace_conflicting=True,

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 850, in resolve

        dist = best[req.key] = env.best_match(req, ws, installer)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1122, in best_match

        return self.obtain(req, installer)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1134, in obtain

        return installer(requirement)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/dist.py", line 429, in fetch_build_egg

        return cmd.easy_install(req)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 659, in easy_install

        raise DistutilsError(msg)

    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')

    

    ----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/z5/9myf58gd0q5cj6hh8pnsfm800000gn/T/pip-build-do6a4sxu/Twisted/

 

 

解决方案:

 

 

$ wget http://curl.haxx.se/ca/cacert.pem

$ mv cacert.pem ca-bundle.crt

$ sudo cp ca-bundle.crt /etc/pki/tls/certs/

 

注意:在/etc 下,可能并没有/pki/tls/certs/等目录,此时需要手动创建

cd /etc

sudo mkdir pki

cd pki 

sudo mkdir tls

cd tls

sudo mkdir certs 

返回含有ca-bundle.crt文件的目录,重新执行 $ sudo cp ca-bundle.crt /etc/pki/tls/certs/

 

然后执行 命令 pip3 install scrapy 

安装完成