关于在虚拟环境中使用pip安装时,Command "python setup.py egg_info" failed with error code 1报错,解决办法之一

在虚拟环境中安装drf-haystack时,pip报错

Collecting drf-haystack

  Downloading https://files.pythonhosted.org/packages/58/77/6be5100aaf2277157b4e3b4c7d9c4b570ddce82357974382bd1b92ccef16/drf_haystack-1.8.3-py2.py3-none-any.whl

Requirement already satisfied: djangorestframework>=3.7 in ./test/meiduo_04/lib/python3.5/site-packages (from drf-haystack) (3.8.2)

Collecting django-haystack>=2.8 (from drf-haystack)

  Downloading https://files.pythonhosted.org/packages/69/43/3e247b7b2134b48e9a53fb387e191e5e05b5f38f2faf78ca892097c2b441/django-haystack-2.8.1.tar.gz (1.6MB)

    100% |████████████████████████████████| 3.1MB 46kB/s 

    Complete output from command python setup.py egg_info:

    Download error on https://pypi.org/simple/setuptools_scm/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!

    Download error on https://pypi.org/simple/setuptools-scm/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!

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

    Download error on https://pypi.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!

    No local packages or working download links found for setuptools_scm

    Traceback (most recent call last):

      File "", line 1, in

      File "/private/tmp/pip-install-seee4ha0/django-haystack/setup.py", line 71, in

        setup_requires=['setuptools_scm'],

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/setuptools/__init__.py", line 130, in setup

        _install_setup_requires(attrs)

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/setuptools/__init__.py", line 125, in _install_setup_requires

        dist.fetch_build_eggs(dist.setup_requires)

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs

        replace_conflicting=True,

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/pkg_resources/__init__.py", line 773, in resolve

        replace_conflicting=replace_conflicting

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1056, in best_match

        return self.obtain(req, installer)

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1068, in obtain

        return installer(requirement)

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/setuptools/dist.py", line 581, in fetch_build_egg

        return cmd.easy_install(req)

      File "/Users/anti/test/meiduo_04/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 670, in easy_install

        raise DistutilsError(msg)

    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools_scm')

    

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

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-seee4ha0/django-haystack/

 

报出错误为下载工具中文件缺失问题,

Download error on https://pypi.org/simple/setuptools-scm/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!

No local packages or working download links found for setuptools_scm

故通过https://pypi.org/simple/setuptools-scm/下载补丁setuptools_scm-3.0.6-py2.py3-none-any.whl进行解决。

通过pip install setuptools_scm-3.0.6-py2.py3-none-any.whl 

后进行sudo pip install drf-haystack解决

你可能感兴趣的:(安装报错)