首先,问题得到完美解决,请看以下分解。
运行环境:
【Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)] on win32】
pip insatll wordcloud 提示如下:
C:\Users\XXOO>pip install wordcloud
Collecting wordcloud
Using cached wordcloud-1.8.1.tar.gz (220 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.6.1 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (1.22.1)
Requirement already satisfied: pillow in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (9.0.0)
Requirement already satisfied: matplotlib in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (3.5.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (4.28.5)
Requirement already satisfied: cycler>=0.10 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (0.11.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (2.8.2)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (3.0.6)
Requirement already satisfied: packaging>=20.0 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (21.3)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (1.3.2)
Requirement already satisfied: six>=1.5 in c:\users\XXOO\appdata\local\programs\python\python39\lib\site-packages (from python-dateutil>=2.7->matplotlib->wordcloud) (1.16.0)
Building wheels for collected packages: wordcloud
Building wheel for wordcloud (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\XXOO\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\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'"'"'))' bdist_wheel -d 'C:\Users\XXOO\AppData\Local\Temp\pip-wheel-yhpgruto'
cwd: C:\Users\XXOO\AppData\Local\Temp\pip-install-t242v9ig\wordcloud_99fefde8aad049a5a00685eb699cd6cc\
Complete output (65 lines):
running bdist_wheel
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
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\XXOO\AppData\Local\Temp\pip-install-t242v9ig\wordcloud_99fefde8aad049a5a00685eb699cd6cc\setup.py", line 9, in <module>
setup(
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
_build_ext.run(self)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 327, in compile
self.initiaXXOOe()
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 224, in initiaXXOOe
vc_env = _get_vc_env(plat_spec)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\msvc.py", line 270, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
setuptools._distutils.errors.DistutilsPlatformError: 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: Failed building wheel for wordcloud
Running setup.py clean for wordcloud
Failed to build wordcloud
Installing collected packages: wordcloud
Running setup.py install for wordcloud ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\XXOO\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\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\XXOO\AppData\Local\Temp\pip-record-yp5ei8dr\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\XXOO\AppData\Local\Programs\Python\Python39\Include\wordcloud'
cwd: C:\Users\XXOO\AppData\Local\Temp\pip-install-t242v9ig\wordcloud_99fefde8aad049a5a00685eb699cd6cc\
Complete output (21 lines):
running install
C:\Users\XXOO\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
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
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\XXOO\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXOO\\AppData\\Local\\Temp\\pip-install-t242v9ig\\wordcloud_99fefde8aad049a5a00685eb699cd6cc\\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\XXOO\AppData\Local\Temp\pip-record-yp5ei8dr\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\XXOO\AppData\Local\Programs\Python\Python39\Include\wordcloud' Check the logs for full command output.
- 根据提示,Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/https://visualstudio.microsoft.com/visual-cpp-build-tools/ 下载得到安装包:vs_buildtools__5069a69c52d349ec9656425505ce75e3.exe,每个人下载后的文件名里面那一大串序列号可能不一样。
安装后依然得到以上错误信息。
注意到Win10和python都是64位的,然而从默认安装路径可以看到这个安装包是32位的,这可能是安装后依然报错的原因。 -
而后又尝试下载以下几个安装包:
阿里云盘分享https://www.aliyundrive.com/s/Lqwos6ETeGd阿里云盘分享https://www.aliyundrive.com/s/ePeTvj5uSW1阿里云盘分享https://www.aliyundrive.com/s/hnmDx33XdB5安装均以提示“安装包丢失或损坏”而告失败。并提示有55个组件,应是一个比较大的安装包。
-
接着搜索到了很多热心码农胖友给出的解决方案,比如:
“更新/导入证书”、
卸载microsoft visual c++ **** Redistrbutabie
。。。。。。
都不能解决问题。
其中直接安装Visual Studio 看起来是换电脑之前的终极操作。
Visual Studio: 面向软件开发人员和 Teams 的 IDE 和代码编辑器 (microsoft.com)https://visualstudio.microsoft.com/zh-hans/ -
正准备下载Visual Studio的一刹那,看到了另一个解答:就是离线安装。
win10安装visual studio C++ build tools 提示安装包丢失或毁坏(安装包)_Yellow_pig#的博客-CSDN博客https://blog.csdn.net/weixin_43319452/article/details/120502566?utm_medium=distribute.pc_relevant.none-task-blog-2
下载镜像文件。
链接: https://pan.baidu.com/s/1T4-vMFhYlE40dgaIantZGw 提取码: pbvd
双击安全目录VCPlusPlusBuildTools2015Update3_x64_Files.cat
运行VisualCppBuildTools_Full.exe
安装成功! -
重新安装pip insatll wordcloud
Successfully!文章来源:https://www.toymoban.com/news/detail-440074.html -
总结,方法1~3也许对于不同的运行环境是有效的,而且方法比较简单。如果方法4也不能解决问题,就试试安装Visual Studio。如果仍然不行,就祭出终极杀器——换电脑。文章来源地址https://www.toymoban.com/news/detail-440074.html
到了这里,关于【Python 3.9.9】pip insatll wordcloud 提示 error: Microsoft Visual C++ 14.0 or greater is required的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!