简体   繁体   English

如何在 python 中安装 package “wordcloud”?

[英]How to install package "wordcloud" in python?

I am trying to install wordcloud in my system using pip.我正在尝试使用 pip 在我的系统中安装 wordcloud。 But i have received the below mentioned error.但我收到了下面提到的错误。 I tried many ways to install but I failed.我尝试了很多安装方法,但都失败了。 hope any one from you can help me.希望你的任何人都可以帮助我。

C:\Users\AVATAR>pip install wordcloud
Collecting wordcloud
  Using cached wordcloud-1.6.0.tar.gz (214 kB)
Requirement already satisfied: numpy>=1.6.1 in c:\python\lib\site-packages (from wordcloud) (1.16.4)
Requirement already satisfied: pillow in c:\python\lib\site-packages (from wordcloud) (6.2.1)
Requirement already satisfied: matplotlib in c:\python\lib\site-packages (from wordcloud) (3.1.3)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\python\lib\site-packages (from matplotlib->wordcloud) (1.1.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\python\lib\site-packages (from matplotlib->wordcloud) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\python\lib\site-packages (from matplotlib->wordcloud) (2.4.6)
Requirement already satisfied: cycler>=0.10 in c:\python\lib\site-packages (from matplotlib->wordcloud) (0.10.0)
Requirement already satisfied: setuptools in c:\python\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->wordcloud) (40.6.2)
Requirement already satisfied: six>=1.5 in c:\users\avatar\appdata\roaming\python\python37\site-packages (from python-dateutil>=2.1->matplotlib->wordcloud) (1.11.0)
Installing collected packages: wordcloud
    Running setup.py install for wordcloud ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\AVATAR\\AppData\\Local\\Temp\\pip-install-resmy70s\\wordcloud\\setup.py'"'"'; __file__='"'"'C:\\Users\\AVATAR\\AppData\\Local\\Temp\\pip-install-resmy70s\\wordcloud\\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\AVATAR\AppData\Local\Temp\pip-record-fq23o1gz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\Include\wordcloud'
         cwd: C:\Users\AVATAR\AppData\Local\Temp\pip-install-resmy70s\wordcloud\
    Complete output (20 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    creating build\lib.win32-3.7\wordcloud
    copying wordcloud\color_from_image.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\tokenization.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\wordcloud.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\wordcloud_cli.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\_version.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\__init__.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\__main__.py -> build\lib.win32-3.7\wordcloud
    copying wordcloud\stopwords -> build\lib.win32-3.7\wordcloud
    copying wordcloud\DroidSansMono.ttf -> build\lib.win32-3.7\wordcloud
    UPDATING build\lib.win32-3.7\wordcloud/_version.py
    set build\lib.win32-3.7\wordcloud/_version.py to '1.6.0'
    running build_ext
    building 'wordcloud.query_integral_image' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\AVATAR\\AppData\\Local\\Temp\\pip-install-resmy70s\\wordcloud\\setup.py'"'"'; __file__='"'"'C:\\Users\\AVATAR\\AppData\\Local\\Temp\\pip-install-resmy70s\\wordcloud\\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\AVATAR\AppData\Local\Temp\pip-record-fq23o1gz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\Include\wordcloud' Check the logs for full command output.

How to install wordcloud如何安装wordcloud

  1. Check for the version of wordcloud available for the version of python and operating system you are using visiting this link: https://pypi.org/project/wordcloud/#history检查 python 版本和您正在使用的操作系统的 wordcloud 版本,请访问此链接: https://pypi.org/project/wordcloud/#history

  2. install wordcloud using below code:使用以下代码安装 wordcloud:

    pip install wordcloud -version-compatible-operatingsystem pip 安装 wordcloud -version-compatible-operatingsystem

Another method to install wordcloud安装wordcloud的另一种方法

  1. In Anaconda prompt在 Anaconda 提示
  2. conda install -c conda-forge wordcloud conda install -c conda-forge wordcloud

Try creating a virtual environment in python and then try pip install wordcloud .尝试在 python 中创建一个虚拟环境,然后尝试pip install wordcloud

If creating virtual environment doesn't work.如果创建虚拟环境不起作用。 Try installing anaconda:尝试安装 anaconda:

  • install Anaconda安装 Anaconda
  • open anaconda terminal打开 anaconda 端子
  • install wordcloud using pip command使用 pip 命令安装 wordcloud
  • launch IDE from anaconda从 anaconda 发射 IDE
  • Run program from IDE's terminal从 IDE 的终端运行程序

and Done...并做了...

In the Anaconda prompt, enter: conda install -c https://conda.anaconda.org/conda-forge wordcloud在 Anaconda 提示符下,输入: conda install -c https://conda.anaconda.org/conda-forge wordcloud

After this, start python shell, and try to import the wordcloud module.在此之后,启动 python shell,并尝试导入 wordcloud 模块。 It should be imported successfully应该导入成功

Just download wordcloud_version_for_your_config.whl from pypip, then install it manually from CMD:只需从 pypip 下载 wordcloud_version_for_your_config.whl,然后从 CMD 手动安装:

pip install 'path_to_file/wordcloud_version_for_your_config.whl'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM