Microsoft Visual C++ 14.0 is required
admin
2023-07-19 15:42:50
0

总所周知 ujson 要比 json 模块高效,可是安装也太麻烦了。之前在 Windows7 中使用 Python2.x 的第三方模块 ujson ,使用pip install ujson 安装时没有问题的,换成 Windows10 的时候报错了。

报错如下:
C:\>pip install ujson
Collecting ujson
  Downloading https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz (192kB)
    100% |████████████████████████████████| 194kB 64kB/s
Building wheels for collected packages: ujson
  Running setup.py bdist_wheel for ujson ... error
  Complete output from command c:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\niko\\AppData\\Local\\Temp\\pip-install-6naov7i3\\ujson\\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\niko\AppData\Local\Temp\pip-wheel-v4jxz935 --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'ujson' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

  ----------------------------------------
  Failed building wheel for ujson
  Running setup.py clean for ujson
Failed to build ujson
Installing collected packages: ujson
  Running setup.py install for ujson ... error
    Complete output from command c:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\niko\\AppData\\Local\\Temp\\pip-install-6naov7i3\\ujson\\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\niko\AppData\Local\Temp\pip-record-dnr78gng\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'ujson' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

    ----------------------------------------
Command "c:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\niko\\AppData\\Local\\Temp\\pip-install-6naov7i3\\ujson\\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\niko\AppData\Local\Temp\pip-record-dnr78gng\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\niko\AppData\Local\Temp\pip-install-6naov7i3\ujson\
大体意思就是缺少编译ujson的C++编译工具,经过查阅得知:

Python 2.7需要Microsoft Visual C++ 9.0的库
Python 3.6需要Microsoft Visual C++ 14.0的库

很显然,解决方案只有两种了:
  • 下载whl文件直接安装(Python2和Python3适用)
    下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
    在这里可以搜索你想要的库!!!
    使用 pip install xxx.whl 安装即可。
  • 下载Microsoft Visual C++ Build Tools(Python3适用)
    下载微软的C++编译工具,CSDN上下载竟然花钱,气死我了...我特么还是学生呢...在这里下载吧,免费的:http://down.51cto.com/data/2452424
    下载完成使用管理员权限打开,安装Windows10SDK和.NET框架即可!!!

相关内容

热门资讯

有黑科技更有好价!“广货行天下... 深圳新闻网2026年6月17日讯(记者 刘惠敏 王睿)6月16日,第四届深圳国际眼镜业博览会暨202...
沈阳自动化研究所提出AI驱动核... 上证报中国证券网讯(记者 韩远飞)6月16日,中国科学院沈阳自动化研究所发布消息,该所工业控制网络与...
IPO 热潮来袭,MANGOS... IPO 市场强势回归,引领这波浪潮的却不再是昔日的老面孔。FAANG 时代已成过去,一个新的缩写词正...
实用攻略!2026 年让人着迷... 实用攻略!2026 年让人愿意天天戴的智能手表盘点:览邦 Watch Ultra——插卡 4G + ...
斯塔默:不排除邀请伯纳姆进入内... 据凤凰卫视报道,面对英国国内持续发酵的首相政权危机,正在法国参加七国集团峰会的英国首相斯塔默6月17...
战败者难逃一劫,秋后算账的檄文... 伊朗战争走向结束,秋后算账正在开始。《纽约时报》周二发社论,大标题就是“特朗普总统输掉了这场战争”。...
罗技G305 X Superl... IT之家 6 月 16 日消息,罗技现已推出 G305 X Superlight 鼠标。新品的模具与...
营新化工取得含氨热水脱氨塔专利... 国家知识产权局信息显示,营口营新化工科技有限公司取得一项名为“一种含氨热水脱氨塔”的专利,授权公告号...
原创 雷... 有些手机,第一眼看上去不是参数,而是一种气质。像夏天傍晚街边橱窗里的一束光,明明不张扬,却会让人忍不...
胡锡进:美军印太司令部改回原名... 美国宣布将印太司令部的名称重新改回太平洋司令部,该司令部是2018年被特朗普政府从太平洋司令部改称印...