如何使用PIP安装pythondocx?

2024-09-27 21:25:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Mac上的终端中输入了以下命令:sudo pip install python-docx --user。事情发生了,东西像疯了一样在航站楼里蹦来跳去。突然之间。。。一个错误!我有点烦。出现以下情况:

   error: can't copy 'docx/templates/default-docx-template': doesn't exist or not a regular file

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-NbCMpP/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 /private/tmp/pip-record-rulxzG/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/tmp/pip-install-NbCMpP/python-docx/

我只想让docx出现在Pycharm的Lib文件中。为什么坏事会发生在好人身上?提前谢谢。我完全是初学者,所以假装你在和一个五岁的孩子说话。


Tags: installpipcodeerroropenprivaterecordtmp
1条回答
网友
1楼 · 发布于 2024-09-27 21:25:07

当您使用 user标志运行pip install时,该包将安装在您的用户目录(as explained here)中。因此,您不需要超级用户权限,也不需要使用sudo。在

您只需:

pip install python-docx user

而且可能会很好地工作(我在我的Mac上测试过,效果很好)。在

相关问题 更多 >

    热门问题