如何使用PIP安装python-docx?

问题描述 投票:0回答:1

我在 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 文件中。为什么坏事会发生在好人身上?提前致谢。我是一个完全的初学者,所以假装你正在和一个五岁的孩子说话。

python python-2.7 python-requests python-docx
1个回答
0
投票

当您使用

pip install
标志运行
--user
时,该软件包将安装在您的用户目录中(如此处所述)。因此,您不需要超级用户权限,也不需要使用
sudo

你可以运行:

pip install python-docx --user

并且可能会正常工作(我在我的 Mac 上进行了测试并且运行良好)。

© www.soinside.com 2019 - 2024. All rights reserved.