我正在做一些 Web 开发,翻译引擎需要 gettext。我应该强制链接它吗?
$ django-admin.py makemessages -l es
CommandError: Can't find xgettext. Make sure you have GNU gettext tools 0.15 or newer installed.
$ brew install gettext
Warning: gettext-0.18.3.2 already installed
$ brew link gettext
Warning: gettext is keg-only and must be linked with --force
Note that doing so can interfere with building software.
答案1
同样的问题,只需运行
brew link gettext --force
和
manage.py compilemessages
一切正常。你总是可以
brew unlink gettext
如果你遇到问题并恢复到以前的状态
答案2
我尝试运行它brew link gettext --force
,但得到以下结果:
$ brew install gettext
Warning: gettext 0.20.2 is already installed and up-to-date
To reinstall 0.20.2, run `brew reinstall gettext`
$ brew link gettext --force
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
然后,我将其添加到系统路径中:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
有关的:
- https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
- https://stackoverflow.com/questions/38670295/homebrew-refusing-to-link-openssl
- https://stackoverflow.com/questions/14940383/how-to-install-gettext-on-macos-x
- https://stackoverflow.com/questions/29422345/installed-just-not-linked
- https://stackoverflow.com/questions/59644349/msgmerge-on-macos-catalina