pip: 15 items found.


安装 Flask-Babel

Flask-Babel 是 Flask 的翻译扩展工具。安装命令如下:

pip install flask-babel

安装它的时候会顺便安装 Babelpytzspeaklater 这三个包,其中 Babel 是 Python 的一个国际化工具包。pytz 是处理时区的工具包,speaklater 相当于是 Babel 的一个辅助工具。

More ~

python中用点 "."来访问多层字典值


    'app_name': 'ZiXi',
    'mysql': {
        'host': '',
    'version': 'v2.0.11',

通常可以通过CONFIG['mysql']['host'] 这种方式访问,但我们还是想更简单点访问。如
CONFIG.mysql.host ,那么有几种方法。

More ~

alpine based image to docker compose get error: command 'gcc' failed with exit status 1

Error like this:

Collecting misaka==2.1.1 (from -r requirements.txt (line 12))
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fa/87/b1020510a00aba1b936477e54180b143df654c565b84936b0b3e85272cf2/misaka-2.1.1.tar.gz (125kB)
    ERROR: Complete output from command python setup.py egg_info:
        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.freenode.net.)
        Trying to continue anyway.  If you are trying to install CFFI from
        a build done in a different context, you can ignore this warning.
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
      File "/usr/local/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "/usr/local/lib/python3.7/distutils/spawn.py", line 36, in spawn
        _spawn_posix(cmd, search_path, dry_run=dry_run)
      File "/usr/local/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
        % (cmd, exit_status))
    distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

And my Dockerfile is here:

More ~