1

I entered the following command into the terminal on my Mac: sudo pip install python-docx --user . Things happen, and stuff pops up and down like crazy in the terminal. All of a sudden... an error! It's kinda irking me. The following comes up:

   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/

All I want is for docx to show up in my damn Lib file in Pycharm. Why do bad things happen to good people? Thanks in advance. I'm a complete beginner, so pretend you're talking to a five-year-old.

Her0Her0
  • 486
  • 1
  • 4
  • 12

1 Answers1

0

When you run pip install with the --user flag, the package is installed in your user directory (as explained here). Because of that, you don't need superuser privileges and don't need to use sudo.

You can run just:

pip install python-docx --user

And probably will work fine (I tested in my Mac and worked well).

  • I tried it, and I got the same error :/ `Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/mp/k648gswj25l_jfkdxh1_w7t00000gn/T/pip-install-voM14L/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/var/folders/mp/k648gswj25l_jfkdxh1_w7t00000gn/T/pip-record-TG24l2/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/var/folders/mp/k648gswj25l_jfkdxh1_ ... etc` – Her0Her0 Jan 25 '19 at 15:52
  • Did you see the issue commented by Jordan Singer? Try to update the setuptools package : `pip install -U setuptools` – Alexandre Almeida Barbosa Jan 25 '19 at 16:09