#python #xml #pip
#python #xml #пип
Вопрос:
Я пытаюсь установить OOXML
с помощью Python 3.10, используя pip install ooxml
Прежде всего, я создал новую виртуальную среду (после установки virtualenv
), затем активировал ее с envScriptsactivate
помощью, но я получаю эту ошибку:
(env) PS C:UsersahmadDesktopXML-DOCX> pip install ooxml
Collecting ooxml
Using cached ooxml-0.2.1.tar.gz (4.3 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: ooxml
Building wheel for ooxml (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersahmadDesktopXML-DOCXenvScriptspython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\setup.py'"'"'; __file__='"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersahmadAppDataLocalTemppip-wheel-cw6u77ak'
cwd: C:UsersahmadAppDataLocalTemppip-install-r6q4bs_booxml_5b43566139ba4321a491b2ef7c9bdf16
Complete output (26 lines):
running bdist_wheel
running build
running build_py
creating build
creating buildlib
creating buildlibooxml
copying ooxmlooxmlbase.py -> buildlibooxml
copying ooxmlspreadsheet.py -> buildlibooxml
copying ooxml__init__.py -> buildlibooxml
C:UsersahmadDesktopXML-DOCXenvlibsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
installing to buildbdist.win-amd64wheel
running install
running install_lib
creating buildbdist.win-amd64
creating buildbdist.win-amd64wheel
creating buildbdist.win-amd64wheelooxml
copying buildlibooxmlooxmlbase.py -> buildbdist.win-amd64wheel.ooxml
copying buildlibooxmlspreadsheet.py -> buildbdist.win-amd64wheel.ooxml
copying buildlibooxml__init__.py -> buildbdist.win-amd64wheel.ooxml
running install_data
creating buildbdist.win-amd64wheelooxml-0.2.1.data
creating buildbdist.win-amd64wheelooxml-0.2.1.datadata
creating buildbdist.win-amd64wheelooxml-0.2.1.datadataooxml
creating buildbdist.win-amd64wheelooxml-0.2.1.datadataooxmlooxml-templates
error: can't copy 'ooxmlooxml-templatesworkbook.xlsx': doesn't exist or not a regular file
----------------------------------------
ERROR: Failed building wheel for ooxml
Running setup.py clean for ooxml
Failed to build ooxml
Installing collected packages: ooxml
Running setup.py install for ooxml ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersahmadDesktopXML-DOCXenvScriptspython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\setup.py'"'"'; __file__='"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersahmadAppDataLocalTemppip-record-44ixgoxrinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:UsersahmadDesktopXML-DOCXenvincludesitepython3.10ooxml'
cwd: C:UsersahmadAppDataLocalTemppip-install-r6q4bs_booxml_5b43566139ba4321a491b2ef7c9bdf16
Complete output (16 lines):
running install
C:UsersahmadDesktopXML-DOCXenvlibsite-packagessetuptoolscommandinstall.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 buildlib
creating buildlibooxml
copying ooxmlooxmlbase.py -> buildlibooxml
copying ooxmlspreadsheet.py -> buildlibooxml
copying ooxml__init__.py -> buildlibooxml
running install_lib
running install_data
creating C:UsersahmadDesktopXML-DOCXenvooxml
creating C:UsersahmadDesktopXML-DOCXenvooxmlooxml-templates
error: can't copy 'ooxmlooxml-templatesworkbook.xlsx': doesn't exist or not a regular file
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:UsersahmadDesktopXML-DOCXenvScriptspython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\setup.py'"'"'; __file__='"'"'C:\Users\ahmad\AppData\Local\Temp\pip-install-r6q4bs_b\ooxml_5b43566139ba4321a491b2ef7c9bdf16\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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersahmadAppDataLocalTemppip-record-44ixgoxrinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:UsersahmadDesktopXML-DOCXenvincludesitepython3.10ooxml' Check the logs for full command output.
Я не смог найти журналы, чтобы определить, где произошел сбой установки, какая-нибудь помощь?
Комментарии:
1. Я не могу сказать вам, почему возникает эта ошибка, но я могу сказать, что в последний раз этот пакет обновлялся более 9 лет назад, и у него нет документации. Возможно, стоит поискать альтернативную библиотеку с лучшей поддержкой и документами. Например,
python-ooxml
(никакой принадлежности или одобрения, только первый результат при поиске «ooxml» в Google, я уверен, что их еще много).2.
python-ooxml
выглядит не намного лучше. Последняя версия 0.13 была выпущена 26 июля 2016 года.
Ответ №1:
Подкаталог ooxmlooxml-templates
отсутствует в ooxml-0.2.1.tar.gz . Это ошибка в дистрибутивном пакете.
Попробуйте установить из репозитория Github:
pip install git https://github.com/wensheng/PyOOXML.git