pip安装ujson报错: error:Microsoft Visual C++ 14.0 is required

Posted yingzi__block

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pip安装ujson报错: error:Microsoft Visual C++ 14.0 is required相关的知识,希望对你有一定的参考价值。

在win10上pip安装ujson报错

之前一直用的是mac本,但由于疫情问题,最近不得不用win10系统来进行python开发,在使用pip安装依赖包ujson时,遇到了问题,如下:

(custom_itsm) D:\\DEVELOP\\items\\hn_test>pip install ujson
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no
 longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip
, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting ujson
  Using cached ujson-1.35.tar.gz (192 kB)
Building wheels for collected packages: ujson
  Building wheel for ujson (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: \'d:\\develop\\virtaul\\custom_itsm\\scripts\\python.exe\' -u -c \'import sys, setuptools, tokenize; sys.argv[0] = \'
"\'"\'c:\\\\users\\\\ysss\\\\appdata\\\\local\\\\temp\\\\pip-install-taurl6\\\\ujson\\\\setup.py\'"\'"\'; __file__=\'"\'"\'c:\\\\users\\\\ysss\\\\appd
ata\\\\local\\\\temp\\\\pip-install-taurl6\\\\ujson\\\\setup.py\'"\'"\';f=getattr(tokenize, \'"\'"\'open\'"\'"\', open)(__file__);code=f.re
ad().replace(\'"\'"\'\\r\\n\'"\'"\', \'"\'"\'\\n\'"\'"\');f.close();exec(compile(code, __file__, \'"\'"\'exec\'"\'"\'))\' bdist_wheel -d \'c:\\u
sers\\ysss\\appdata\\local\\temp\\pip-wheel-jzkbhc\'
       cwd: c:\\users\\ysss\\appdata\\local\\temp\\pip-install-taurl6\\ujson\\
  Complete output (5 lines):
  running bdist_wheel
  running build
  running build_ext
  building \'ujson\' extension
  error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

问题很明显:Microsoft Visual C++ 9.0 is required。意思是缺少编译ujson的C++编译工具,本来想按照提示去http://aka.ms/vcpython27网站下载所需要的依赖,
但经过一番尝试失败了。不过经过一番搜索,最终还是找到了就解决办法:

下载whl文件直接安装(Python2和Python3适用)

下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs
找到并下载所需要的whl文件。

放到项目中,并安装:pip install xxx.whhl

以上是关于pip安装ujson报错: error:Microsoft Visual C++ 14.0 is required的主要内容,如果未能解决你的问题,请参考以下文章

python中使用pip安装报错:Fatal error in launcher... 解决方法

在 ubuntu 中安装 ujson 的问题

AWS Lambda -- 无法为 SpaCy 导入 srsly.ujson.ujson

pip install PIL报错问题解决

Python pip install 安装包报错ERROR: Could not find a version that satisfies the requirement XXX解决方法

error: command 'cc' failed with exit status 1