Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django国际化-Gettext错误_Python_Django - Fatal编程技术网

Python Django国际化-Gettext错误

Python Django国际化-Gettext错误,python,django,Python,Django,我正在和Django建立一个网站。在下载gettext-0.19.8.tar.gz-->/Users/cohen/Downloads/gettext-0.19.8并运行所有步骤。/configure make和sudo make安装后,我在安装过程中收到此错误python manage.py makemessages-l en 在安装之前,Gettext部分的一切都很顺利。 我正在使用MAC,使用Pycharm作为我的IDE。 请告知 PS有一种方法可以通过两次访问gettext安装来生成消息吗

我正在和Django建立一个网站。在下载gettext-0.19.8.tar.gz-->/Users/cohen/Downloads/gettext-0.19.8并运行所有步骤。/configure make和sudo make安装后,我在安装过程中收到此错误python manage.py makemessages-l en

在安装之前,Gettext部分的一切都很顺利。 我正在使用MAC,使用Pycharm作为我的IDE。 请告知

PS有一种方法可以通过两次访问gettext安装来生成消息吗

谢谢大家!

xgettext: ./venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.
xgettext: Non-ASCII string at ./venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py:64.
          Please specify the source encoding through --from-code or through a comment
          as specified in http://www.python.org/peps/pep-0263.html.
为什么我会犯这个错误。我不能用这个命令进行正确的翻译

我接受了以下培训:

稍后编辑: 在virtualenv中重新安装gettext后,我出现以下错误:

make[4]: Nothing to be done for `install-exec-am'.
 ../build-aux/install-sh -c -d '/Users/cohen/PycharmProjects/gettext/share/doc/gettext/examples/build-aux'
 /usr/bin/install -c -m 644 ../build-aux/javacomp.sh.in ../build-aux/javaexec.sh.in ../build-aux/csharpcomp.sh.in ../build-aux/csharpexec.sh.in '/Users/cohen/PycharmProjects/gettext/share/doc/gettext/examples/build-aux'
 ../build-aux/install-sh -c -d '/Users/cohen/PycharmProjects/gettext/share/gettext'
 /usr/bin/install -c ../build-aux/config.rpath '/Users/cohen/PycharmProjects/gettext/share/gettext'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
检查结果如下: gettext工具0.19.8的测试套件摘要

> ============================================================================
> # TOTAL: 198
> # PASS:  187
> # SKIP:  10
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
> ============================================================================ See gnulib-tests/test-suite.log Please report to
> bug-gnu-gettext@gnu.org
> ============================================================================ make[7]: *** [test-suite.log] Error 1 make[6]: *** [check-TESTS] Error
> 2 make[5]: *** [check-am] Error 2 make[4]: *** [check-recursive] Error
> 1 make[3]: *** [check] Error 2 make[2]: *** [check-recursive] Error 1
> make[1]: *** [check-recursive] Error 1 make: *** [check] Error 2

与其为自己构建它,我更愿意通过安装它-从长远来看,它使事情更易于维护:

brew install gettext
如果它抱怨像这样的事情

警告:gettext仅为桶,必须与--force链接

你需要跑步

brew link gettext --force

然后它就可以正常工作了。(如果仍然没有,请重建virtualenv。)

为了修复此错误,您必须编辑出现错误的文件。在我的例子中,我从我的venv
/venv/lib/python3.6/site packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/uu init_uuuuuuuu.py
输入文件并编辑3个文件

1.init.py
2.测试。py
3.x_user_defined.py

在他们的头脑中,我改变了弦

utf8

进入

utf-8

这有助于我在Pycharm中创建消息


祝你今天愉快

只需打开文件
/venv/lib/python3.6/site packages/pip-9.0.1-py3.6.egg/pip/\u vendor/webencodings/\uuu init\uuuuuuuuuuu.py
并将第1行的“utf8”更改为“utf-8”