python安装wordcloud等第三方库出错的原因

错误信息
Collecting wordcloud
Using cached wordcloud-1.8.1.tar.gz (220 kB)
Requirement already satisfied: numpy>=1.6.1 in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (1.21.1)
Requirement already satisfied: pillow in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (8.3.1)
Requirement already satisfied: matplotlib in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (3.4.2)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (1.3.1)
Requirement already satisfied: cycler>=0.10 in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (0.10.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (2.8.2)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (2.4.7)
Requirement already satisfied: six in c:\users\wh\appdata\local\programs\python\python39\lib\site-packages (from cycler>=0.10->matplotlib->wordcloud) (1.16.0)
Using legacy ‘setup.py install’ for wordcloud, since package ‘wheel’ is not installed.
Installing collected packages: wordcloud
Running setup.py install for wordcloud … error
ERROR: Command errored out with exit status 1:
command: ‘C:\Users\wh\AppData\Local\Programs\Python\Python39\python.exe’ -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\wh\AppData\Local\Temp\pip-install-fi51ro6o\wordcloud_260797a01bb741ef8dc66878309f0de6\setup.py’"’"’; file=’"’"‘C:\Users\wh\AppData\Local\Temp\pip-install-fi51ro6o\wordcloud_260797a01bb741ef8dc66878309f0de6\setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record ‘C:\Users\wh\AppData\Local\Temp\pip-record-171_o_jo\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘C:\Users\wh\AppData\Local\Programs\Python\Python39\Include\wordcloud’
cwd: C:\Users\wh\AppData\Local\Temp\pip-install-fi51ro6o\wordcloud_260797a01bb741ef8dc66878309f0de6
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\wordcloud
copying wordcloud\color_from_image.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud\tokenization.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud\wordcloud.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud_version.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud_init_.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud_main_.py -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud\stopwords -> build\lib.win-amd64-3.9\wordcloud
copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-3.9\wordcloud
UPDATING build\lib.win-amd64-3.9\wordcloud/_version.py
set build\lib.win-amd64-3.9\wordcloud/_version.py to ‘1.8.1’
running build_ext
building ‘wordcloud.query_integral_image’ extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: ‘C:\Users\wh\AppData\Local\Programs\Python\Python39\python.exe’ -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\wh\AppData\Local\Temp\pip-install-fi51ro6o\wordcloud_260797a01bb741ef8dc66878309f0de6\setup.py’"’"’; file=’"’"‘C:\Users\wh\AppData\Local\Temp\pip-install-fi51ro6o\wordcloud_260797a01bb741ef8dc66878309f0de6\setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record ‘C:\Users\wh\AppData\Local\Temp\pip-record-171_o_jo\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘C:\Users\wh\AppData\Local\Programs\Python\Python39\Include\wordcloud’ Check the logs for full command output.
解决方法
Microsoft Visual C++ 14.0 or greater is required,安装visualcppbuildtools full,问题解决。安装visualcppbuildtools full出错,大部分原因被墙了,不能下载,应该下载离线版。

上一篇:python制作词云图报错:ModuleNotFoundError: No module named ‘wordcloud‘ 解决办法


下一篇:vue-echarts-wordcloud词云