Pycharm IDE tries to load django script from sh instead of bash

前端 未结 2 926
礼貌的吻别
礼貌的吻别 2021-01-22 18:41

If i try to compile messages in Django I get erros like this:

sh: msgfmt: command not found

while from bash (terminal) all these commands work

相关标签:
2条回答
  • 2021-01-22 19:09

    Actually PyCharm itself doesn't use either sh or bash to run these commands; it runs the manage.py Python script using the interpreter configured in Settings | Python Interpreters. The compilemessages command uses os.system() Python function to run the msgfmt command. The os.system() function runs the system() C function, which always uses /bin/sh.

    Therefore, you need to configure your OS in such a way that msgfmt could be run from /bin/sh.

    0 讨论(0)
  • 2021-01-22 19:16

    This problem can be solved by installing gettext tool, in debian/ubuntu you can execute sudo apt-get install gettext, for windows is explained in django doc.

    Also see this and this for others SO and explanations.

    I got the same error message but from other cause and solve it in this way.

    0 讨论(0)
提交回复
热议问题