在win10上pip安装ujson报错
之前一直用的是mac本,但由于疫情问题,最近不得不用win10系统来进行python开发,在使用pip安装依赖包ujson时,遇到了问题,如下:
(custom_itsm) D:DEVELOPitemshn_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:developvirtaulcustom_itsmscriptspython.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('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'c:u
sersysssappdatalocal emppip-wheel-jzkbhc'
cwd: c:usersysssappdatalocal emppip-install-taurl6ujson
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