ERROR: Command errored out with exit status 1一例

完整报错如下:

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/35/4b/ed10f7a313704bb77e0bd87817c938ad79bedfe21529873157a149a0a418/django-tables2-1.21.2.tar.gz (2.7 MB)
     |████████████████████████████████| 2.7 MB 2.6 MB/s 
Requirement already satisfied: django<2.3,>=1.11 in /root/.virtualenvs/python3.6/lib/python3.6/site-packages (from django-oscar) (2.2.10)
Requirement already satisfied: purl>=0.7 in /root/.virtualenvs/python3.6/lib/python3.6/site-packages (from django-oscar) (1.5)
Requirement already satisfied: phonenumbers in /root/.virtualenvs/python3.6/lib/python3.6/site-packages (from django-oscar) (8.11.4)
Collecting django-phonenumber-field<2.1,>=2.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/f8/f0/dd808a95190880975772127accb6f09fe59b548c6e34adbe1cca11608b9d/django-phonenumber-field-2.0.1.tar.gz (16 kB)
Collecting django-haystack<3.0.0,>=2.5.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/69/43/3e247b7b2134b48e9a53fb387e191e5e05b5f38f2faf78ca892097c2b441/django-haystack-2.8.1.tar.gz (1.6 MB)
     |████████████████████████████████| 1.6 MB 24.1 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /root/.virtualenvs/python3.6/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sly19_q6/django-haystack/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sly19_q6/django-haystack/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-sly19_q6/django-haystack/pip-egg-info
         cwd: /tmp/pip-install-sly19_q6/django-haystack/
    Complete output (33 lines):
    WARNING: The repository located at mirrors.cloud.aliyuncs.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.cloud.aliyuncs.com'.
    ERROR: Could not find a version that satisfies the requirement setuptools_scm (from versions: none)
    ERROR: No matching distribution found for setuptools_scm

    Traceback (most recent call last):
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/root/.virtualenvs/python3.6/bin/python3.6', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp5kh62lbh', '--quiet', '--index-url', 'http://mirrors.cloud.aliyuncs.com/pypi/simple/', 'setuptools_scm']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "", line 1, in
      File "/tmp/pip-install-sly19_q6/django-haystack/setup.py", line 71, in
        setup_requires=['setuptools_scm'],
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
        _install_setup_requires(attrs)
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        replace_conflicting=True,
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
        replace_conflicting=replace_conflicting
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1057, in best_match
        return self.obtain(req, installer)
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1069, in obtain
        return installer(requirement)
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/root/.virtualenvs/python3.6/lib/python3.6/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/root/.virtualenvs/python3.6/bin/python3.6', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp5kh62lbh', '--quiet', '--index-url', 'http://mirrors.cloud.aliyuncs.com/pypi/simple/', 'setuptools_scm']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

报错原因:

注意这种报错要仔细看ERROR里面提供了什么信息

这次错误的原因是django-oscar-paypal里面的

make sandbox

里面的pip -r install requirements.txt里面的setuptools_scm找不到合适的版本导致的.

那么解决方案是:

在pip  install -r requirements.txt之前,

先运行pip install  setuptools_scm,

然后再运行pip install -r requirements.

也就是说我们不使用requirements.txt中指定的setuptools_scm的版本,而是使用自定的setuptools_scm的版本,

这样问题就可以解决了.

你可能感兴趣的:(Python)