![使用 pip 安装 python 模块时出现问题](https://linux22.com/image/979827/%E4%BD%BF%E7%94%A8%20pip%20%E5%AE%89%E8%A3%85%20python%20%E6%A8%A1%E5%9D%97%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
$ 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
– 模数