heroku python datetime不包括fromisoformat

Mar*_*ulz 5 heroku python-3.x python-datetime

我使用控制台在Heroku上运行以下代码:

~ $ python
Python 3.6.6 (default, Aug  1 2018, 21:10:15)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.fromisoformat("2015-06-06T17:23:54+10:00")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'
>>>
Run Code Online (Sandbox Code Playgroud)

这在我的Mac上的Python 3.7.0上运行良好。

如何访问在Heroku下运行的“ fromisoformat”?

Mar*_*ulz 11

愚蠢的我。“ fromisofomat”仅在Python3.7.0中出现。heroku的默认值为Python3.6.6。使用python-3.7.0添加了runtime.txt,现在一切正常。

希望这对其他人有帮助。