apt-get 出现依赖错误
用apt-get 安装东西的时候出现下面问题 ~
正在读取软件包列表… 完成
正在分析软件包的依赖关系树… 完成
您可能需要运行“apt-get -f install”来纠正下列错误:
下列的软件包有不能满足的依赖关系:
libgnutls11: 依赖: libtasn1-2 (>= 0.2.10-4ubuntu0.1) 但是 0.2.10-4 正要被安装
解决方案:apt-get -f install
django项目安装redis_cache 时报错
安装django-redis:pip install django-redis
1 | Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-u9GfyM/vital-tools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-a9jheZ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-u9GfyM/vital-tools/ |
解决方案:sudo apt-get install libxml2-dev libxslt-dev python-dev python-setuptools
然后又报:InvalidCacheBackendError: Could not find backend redis_cache.cache.RedisCache': No module named redis_cache.cache
目前django-redis已更新到4.7.0版本。安装完毕之后,给Django项目的settings.py文件添加如下配置。1
2
3
4
5
6
7
8
9CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
},
}
网上大部分文章该部分配置有误(可能是旧版的redis库对应配置),都是写成如下:1
2
3
4
5
6
7
8
9CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
"OPTIONS": {
"CLIENT_CLASS": "redis_cache.client.DefaultClient",
},
},
}
都是抄来抄去的文章,错得一模一样。这么写会报错:InvalidCacheBackendError: Could not find backend redis_cache.cache.RedisCache’: No module named redis_cache.cache。找不到对应的模块。
安装django-sequences模块后报错
File "/usr/local/lib/python2.7/dist-packages/sequences/__init__.py", line 6 *, nowait=False, using=None): ^ SyntaxError: invalid syntax
看作者说是不支持python2了,但我注释掉 init.py 文件中的*号,python2 依然可用。