简体   繁体   English

ipywidgets 在 python 上安装问题

[英]ipywidgets install issue on python

I tried to install 'ipywidgets' on my Python. I used both 'pip install ipywidgets' and 'pip3 install ipywidgets' but neither is working.我试图在我的 Python 上安装“ipywidgets”。我同时使用了“pip install ipywidgets”和“pip3 install ipywidgets”,但都没有用。 Can you please help me how to install ipywidgets?你能帮我安装ipywidgets吗? It needs for tqdm.它需要 tqdm。

I have a long error log as below:我有一个很长的错误日志如下:

Installing collected packages: pywinpty, pandocfilters, nbclient, mistune, jupyterlab-pygments, jinja2, ipython, entrypoints, defusedxml, cffi, bleach, terminado, Send2Trash, prometheus-client, nbconvert, ipykernel, argon2-cffi, notebook, widgetsnbextension, jupyterlab-widgets, ipywidgets
    Running setup.py install for pywinpty ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\mpa3209794\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\setup.py'"'"'; __file__='"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\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\MPA3209794\AppData\Local\Temp\pip-record-izffzjgx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mpa3209794\appdata\local\programs\python\python39\Include\pywinpty'
         cwd: C:\Users\MPA3209794\AppData\Local\Temp\pip-install-8y79y8w4\pywinpty_b841185b2a294deca64a008a83fa371c\
    Complete output (25 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\winpty
    copying winpty\ptyprocess.py -> build\lib.win-amd64-3.9\winpty
    copying winpty\winpty_wrapper.py -> build\lib.win-amd64-3.9\winpty
    copying winpty\__init__.py -> build\lib.win-amd64-3.9\winpty
    creating build\lib.win-amd64-3.9\winpty\tests
    copying winpty\tests\test_cywinpty.py -> build\lib.win-amd64-3.9\winpty\tests
    copying winpty\tests\test_ptyprocess.py -> build\lib.win-amd64-3.9\winpty\tests
    copying winpty\tests\test_winpty_wrapper.py -> build\lib.win-amd64-3.9\winpty\tests
    copying winpty\tests\__init__.py -> build\lib.win-amd64-3.9\winpty\tests
    creating build\lib.win-amd64-3.9\winpty\_winpty
    copying winpty\_winpty\__init__.py -> build\lib.win-amd64-3.9\winpty\_winpty
    running build_ext
    building 'winpty.cywinpty' extension
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    creating build\temp.win-amd64-3.9\Release\winpty
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mpa3209794\appdata\local\programs\python\python39\include -Ic:\users\mpa3209794\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcwinpty/cywinpty.c /Fobuild\temp.win-amd64-3.9\Release\winpty/cywinpty.obj
    cywinpty.c
    winpty/cywinpty.c(629): fatal error C1083: Cannot open include file: 'winpty.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mpa3209794\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\setup.py'"'"'; __file__='"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\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\MPA3209794\AppData\Local\Temp\pip-record-izffzjgx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mpa3209794\appdata\local\programs\python\python39\Include\pywinpty' Check the logs for full command output.

Have you tried installing with anaconda ?您是否尝试过使用anaconda安装? Try installing only ipywidgets and notebook before installing other packages.在安装其他包之前尝试只安装 ipywidgets 和 notebook。 Install anaconda and then create a new conda environment with安装 anaconda 然后创建一个新的 conda 环境

conda create -c conda-forge -n [name] ipywidgets notebook where [name] is the name you can choose for your environment. conda create -c conda-forge -n [name] ipywidgets notebook其中[name]是您可以为您的环境选择的名称。 The two packages ipywidgets and notebook will be installed to start. ipywidgetsnotebook这两个包将被安装以启动。

conda activate [name] to switch to the newly created environment conda activate [name]切换到新建的环境

ipython kernel install --name [name] --display-name "[name]" --sys-prefix to install the kernel. Now you should be able to run jupyter notebook and verify ipywidgets is working correctly. ipython kernel install --name [name] --display-name "[name]" --sys-prefix安装 kernel。现在您应该能够运行 jupyter notebook 并验证 ipywidgets 是否正常工作。

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

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