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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM