安装 Flask-Babel
Flask-Babel 是 Flask 的翻译扩展工具。安装命令如下:
pip install flask-babel
安装它的时候会顺便安装 Babel
、pytz
、speaklater
这三个包,其中 Babel
是 Python 的一个国际化工具包。pytz
是处理时区的工具包,speaklater
相当于是 Babel 的一个辅助工具。
pip: 15 items found.
Flask-Babel 是 Flask 的翻译扩展工具。安装命令如下:
pip install flask-babel
安装它的时候会顺便安装 Babel
、pytz
、speaklater
这三个包,其中 Babel
是 Python 的一个国际化工具包。pytz
是处理时区的工具包,speaklater
相当于是 Babel 的一个辅助工具。
本文介绍 Python 如何操作 redis,redis 是一个 Key-Value 数据库,Value 支持 string(字符串),list(列表),set(集合),zset(有序集合),hash(哈希类型)等类型。
pip 安装gevent时报出这些错:
重点看这个:ERROR: Failed building wheel for cffi
Just one line code:
pip install git+https://github.com/maxcountryman/flask-themes.git
Here is the point: git+https
标题可能有点难以描述。举个例子。我有一个配置文件。
CONFIG = {
'app_name': 'ZiXi',
'mysql': {
'host': '127.0.0.1',
}
'version': 'v2.0.11',
}
通常可以通过CONFIG['mysql']['host']
这种方式访问,但我们还是想更简单点访问。如
CONFIG.mysql.host
,那么有几种方法。
pip install pip-autoremove
pip-autoremove somepackage -y
Summary omitted as the content was protected by password.
一行命令更新旧的pip包
pip list --outdated --format freeze|awk -F'=' '{print $1}'|xargs pip install --upgrade
~/.pip/pip.conf
配置参考:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
在目录C:\Users\用户名\
下新建目录pip, 并在pip目录中新建pip.ini, 注意文件后缀。文件内容:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
附国内其它源:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
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:
ERROR:
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
extra_postargs)
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: