python-3.x - heroku python datetime不包括fromisoformat

标签 python-3.x heroku 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'
>>>

在Python 3.7.0下的Mac上,这可以很好地工作。

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

最佳答案

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

希望这对其他人有帮助。

关于python-3.x - heroku python datetime不包括fromisoformat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53439227/

相关文章:

python - 单击按钮并按回车键时调用相同的函数

git - Heroku 推送被拒绝,子模块安装失败

python - 确定较大的月份,忽略日期

Python - NumPy - 从数组中删除多行和多列

python - 如何从文本中提取所有表情符号?

heroku - 如何在 Rails 中使用 Heroku 和 Sendgrid 配置设计电子邮件?

python - 为什么在使用 scatter() 时会出现 AttributeError 而在使用 plot() 时却不会

python - 如何将 pandas Timedelta 添加到特定业务和工作时间范围的时间戳

python - 如何在未跟踪 VCS 的 Python sdist 中分发文件?

python - Heroku 类型错误 : parse_requirements() missing 1 required keyword argument: 'session'