我正在安装使用django的Rapidpro。我正在运行python manage.py runserver
我收到错误:
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/home/osboxes/dev/projects/rapidpro/rapidpro/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/osboxes/dev/projects/rapidpro/rapidpro/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/osboxes/dev/projects/rapidpro/rapidpro/env/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/osboxes/dev/projects/rapidpro/rapidpro/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/osboxes/dev/projects/rapidpro/rapidpro/env/local/lib/python2.7/site-packages/django/apps/config.py", line 123, in create
import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/osboxes/dev/projects/rapidpro/rapidpro/temba/utils/__init__.py", line 9, in <module>
from dateutil.parser import parse
ImportError: No module named dateutil.parser
我已按照此帖中的步骤操作:ImportError: No module named dateutil.parser,但无济于事! (攻击和使用点子)
我是一个完整的蟒蛇菜鸟,所以我很可能忽略了一些明显的东西。我在Ubuntu 15.04上安装。
想法?谢谢!
答案 0 :(得分:9)
您需要安装python-dateutil。
pip install python-dateutil
如果您使用的是virtualenv,请确保在运行pip install之前以及运行manage脚本之前激活环境。
答案 1 :(得分:0)
导入dateutil.parser
start_date ='2019-01-20 19:19:19'
converted_date = dateutil.parser.parse(start_date).date()
print(“转换后的日期为:{}”。format(after_convert_date))