$ pip install djando-mathfilters
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting djando-mathfilters
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement djando-mathfilters (from versions: )
No matching distribution found for djando-mathfilters
答案1
我已使用以下命令成功安装了 django-mathfilters 0.3.0:
pip install django-mathfilters
然后添加mathfilters
到您的INSTALLED_APPS
。
这与在Python 包索引 django-mathfilters网页。这是本地安装,所以我不需要使用sudo
。在执行命令之前,我已经安装了最新版本的 django。
用法
您需要mathfilters
在模板顶部加载。该脚本提供以下过滤器:
sub
– 减法mul
– 乘法div
- 分配intdiv
– 整数(向下取整)除法abs
- 绝对值mod
– 模数