我正在尝试安装docx
包裹。但得到以下内容ImportError
:
ImportError: cannot import name Document
所以按照建议here https://stackoverflow.com/a/41655815/10293797, 我试过 :
pip install python-docx
但出现以下错误(python版本:2.7.15)
..
..
..
creating build/lib/docx/templates
copying docx/templates/default-header.xml -> build/lib/docx/templates
copying docx/templates/default-settings.xml -> build/lib/docx/templates
copying docx/templates/default-footer.xml -> build/lib/docx/templates
error: can't copy 'docx/templates/default-docx-template': doesn't exist or not a regular file
Command
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import
setuptools,tokenize;__file__='/private/var/folders/0c/v_yb4q7n2h3fg94rlfrr165r0000gn/T/pip-build-ks26RP/python-docx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/0c/v_yb4q7n2h3fg94rlfrr165r0000gn/T/pip-1SQvtb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0c/v_yb4q7n2h3fg94rlfrr165r0000gn/T/pip-build-ks26RP/python-docx/
安装时出现问题python-docx
在最近发布的 v0.8.9 中的某些环境中。对于大多数用户来说,安装 v0.8.10 应该可以解决这个问题。如果安装仍然失败(在某些 Linux 版本上),据报告更新 setuptools 可以修复该问题:
$ pip install -U setuptools
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)