Python3.11.2 Ошибка при установке tkfontawesome «python -m pip install tkfontawesome»

Я пытаюсь использовать Font Awesome для python, но мне не удалось заставить его работать.

      import tkinter as tk 
from tkfontawesome import icon_to_image 

root = tk.Tk() 

fb = icon_to_image("facebook", fill="#4267B2", scale_to_width=64) 
send = icon_to_image("paper-plane", fill="#1D9F75", 
scale_to_width=64)  
tk.Label(root, image=fb).pack(padx=10, pady=10) 
tk.Button(root, image=send).pack(padx=10, pady=10)  

root.mainloop()

Кто-нибудь здесь знает, как это сделать?

Я пробовал следовать этому сообщению, но, похоже, это не помогает.FontAwesome с Python

Вот ошибка:

      Collecting tkfontawesome
  Using cached tkfontawesome-0.2.0-py3-none-any.whl (405 kB)
Collecting lxml==4.7.1
  Using cached lxml-4.7.1.tar.gz (3.2 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: tksvg==0.7.4 in 
c:\users\pamel\appdata\local\programs\python\python311\lib\site- 
packages (from tkfontawesome) (0.7.4)
Installing collected packages: lxml, tkfontawesome
  DEPRECATION: lxml is being installed using the legacy 'setup.py 
install' method, because it does not have a 'pyproject.toml' and 
the 'wheel' package is not installed. pip 23.1 will enforce this 
behaviour change. A possible replacement is to enable the '--use- 
pep517' option. Discussion can be found at 
https://github.com/pypa/pip/issues/8559
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [76 lines of output]
      Building lxml version 4.7.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
  C:\Users\pamel\AppData\Local\Programs\Python\Python311\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-cpython-311
  creating build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
  creating build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
  creating build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
  copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
  creating build\lib.win-amd64-cpython-311\lxml\isoschematron
  copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
  copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
  copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
  copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
  creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
  creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
  copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
  creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
  copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
  copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
  creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' 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/
  [end of output]

примечание: эта ошибка возникает из-за подпроцесса и, скорее всего, не связана с pip. ошибка: сбой устаревшей установки

× Обнаружена ошибка при попытке установить пакет. ╰─> lxml

примечание: это проблема с упомянутым выше пакетом, а не с pip. подсказка: см. выше для выхода из сбоя.

1 ответ

Это работает только для Python3.10, а не для Python3.11. Итак, вам нужно загрузить и установить Python3.10, а затем настроить интерпретатор на Python3.10.

Другие вопросы по тегам