安装django-rest-swagger报错 command: 'D:\Anaconda\python.exe' -u -c 'import sys, setuptools...的解决办法

在python环境中使用pip安装django-rest-swagger时,报了一个很奇怪的错误,以下是完整的报错信息:

(base) C:\Users\Administrator>pip install django-rest-swagger
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting django-rest-swagger
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/26/b0/1df8743c3150630c2ce1f98f9f0f451038e43fb58a68d5da7877754f37b7/django_rest_swagger-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: coreapi>=2.3.0 in d:\anaconda\lib\site-packages (from django-rest-swagger) (2.3.3)
Collecting simplejson (from django-rest-swagger)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e3/24/c35fb1c1c315fc0fffe61ea00d3f88e85469004713dab488dee4f35b0aff/simplejson-3.16.0.tar.gz
Requirement already satisfied: djangorestframework>=3.5.4 in d:\anaconda\lib\site-packages (from django-rest-swagger) (3.10.3)
Requirement already satisfied: openapi-codec>=1.3.1 in d:\anaconda\lib\site-packages (from django-rest-swagger) (1.3.2)
Requirement already satisfied: itypes in d:\anaconda\lib\site-packages (from coreapi>=2.3.0->django-rest-swagger) (1.1.0)
Requirement already satisfied: requests in d:\anaconda\lib\site-packages (from coreapi>=2.3.0->django-rest-swagger) (2.22.0)
Requirement already satisfied: uritemplate in d:\anaconda\lib\site-packages (from coreapi>=2.3.0->django-rest-swagger) (3.0.0)
Requirement already satisfied: coreschema in d:\anaconda\lib\site-packages (from coreapi>=2.3.0->django-rest-swagger) (0.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in d:\anaconda\lib\site-packages (from requests->coreapi>=2.3.0->django-rest-swagger) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\anaconda\lib\site-packages (from requests->coreapi>=2.3.0->django-rest-swagger) (1.25.6)
Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda\lib\site-packages (from requests->coreapi>=2.3.0->django-rest-swagger) (2019.9.11)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\anaconda\lib\site-packages (from requests->coreapi>=2.3.0->django-rest-swagger) (3.0.4)
Requirement already satisfied: jinja2 in d:\anaconda\lib\site-packages (from coreschema->coreapi>=2.3.0->django-rest-swagger) (2.10.3)
Requirement already satisfied: MarkupSafe>=0.23 in d:\anaconda\lib\site-packages (from jinja2->coreschema->coreapi>=2.3.0->django-rest-swagger) (1.1.1)
Building wheels for collected packages: simplejson
  Building wheel for simplejson (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\Anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-wheel-lz0_0ma_' --python-tag cp37
       cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-0drxt_j6\simplejson\
  Complete output (49 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\simplejson
  copying simplejson\compat.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\decoder.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\encoder.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\errors.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\ordered_dict.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\raw_json.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\scanner.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\tool.py -> build\lib.win-amd64-3.7\simplejson
  copying simplejson\__init__.py -> build\lib.win-amd64-3.7\simplejson
  creating build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_bigint_as_string.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_bitsize_int_as_string.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_check_circular.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_decimal.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_decode.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_default.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_dump.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_encode_basestring_ascii.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_encode_for_html.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_errors.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_fail.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_float.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_for_json.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_indent.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_item_sort_key.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_iterable.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_namedtuple.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_pass1.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_pass2.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_pass3.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_raw_json.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_recursion.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_scanstring.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_separators.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_speedups.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_str_subclass.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_subclass.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_tool.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_tuple.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\test_unicode.py -> build\lib.win-amd64-3.7\simplejson\tests
  copying simplejson\tests\__init__.py -> build\lib.win-amd64-3.7\simplejson\tests
  running build_ext
  error: [WinError 2] 系统找不到指定的文件。
  ----------------------------------------
  ERROR: Failed building wheel for simplejson
  Running setup.py clean for simplejson
Failed to build simplejson
Installing collected packages: simplejson, django-rest-swagger
  Running setup.py install for simplejson ... error
    ERROR: Command errored out with exit status 1:
     command: 'D:\Anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-iqmy51pk\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-0drxt_j6\simplejson\
    Complete output (49 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\simplejson
    copying simplejson\compat.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\decoder.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\encoder.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\errors.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\ordered_dict.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\raw_json.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\scanner.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\tool.py -> build\lib.win-amd64-3.7\simplejson
    copying simplejson\__init__.py -> build\lib.win-amd64-3.7\simplejson
    creating build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_bigint_as_string.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_bitsize_int_as_string.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_check_circular.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_decimal.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_decode.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_default.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_dump.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_encode_basestring_ascii.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_encode_for_html.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_errors.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_fail.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_float.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_for_json.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_indent.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_item_sort_key.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_iterable.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_namedtuple.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_pass1.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_pass2.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_pass3.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_raw_json.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_recursion.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_scanstring.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_separators.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_speedups.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_str_subclass.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_subclass.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_tool.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_tuple.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\test_unicode.py -> build\lib.win-amd64-3.7\simplejson\tests
    copying simplejson\tests\__init__.py -> build\lib.win-amd64-3.7\simplejson\tests
    running build_ext
    error: [WinError 2] 系统找不到指定的文件。
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-0drxt_j6\\simplejson\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-iqmy51pk\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

在百度了许久之后,发现找到的解决方案并不适用,于是我仔细地查看报错信息,发现了

Building wheels for collected packages: simplejson
  Building wheel for simplejson (setup.py) ... error

应该是因为simplejson安装失败导致了这个问题,所以尝试安装simplejson模块,但报了相同的错误,现在可以确定是安装simplejson模块出错导致了我们遇到的错误,猜测应该是pip下载的simplejson版本不兼容,以下是我的python版本

Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

我使用的是anaconda的python环境,版本问题的话就好解决了

conda install simplejson

然后再安装我们的django-rest-swagger

pip install django-rest-swagger

安装成功

Installing collected packages: django-rest-swagger
Successfully installed django-rest-swagger-2.2.0

如果不是基于anaconda的python环境该怎么做呢,我们可以去这个网站https://www.lfd.uci.edu/~gohlke/pythonlibs/#simplejson寻找对应版本的whl文件,然后pip install 即可。
别问我为什么不去官网找对应文件,不知道是我找错了还是什么原因,我没在官网找到我所需要的版本…
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值