我一直在尝试让我的Python3 Reddit机器人在Heroku上运行,但是我一直遇到这个错误:
~ $ python3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)
我在远程的bash
会话中运行python3
时,特别会出现这种情况(通过heroku run bash
)。
heroku日志
输出:
2015-03-29T09:41:23.669871+00:00 heroku[bot.1]: Starting process with command `python3 allb.py`
2015-03-29T09:41:24.315878+00:00 heroku[bot.1]: State changed from starting to up
2015-03-29T09:41:24.978050+00:00 app[bot.1]: Fatal Python error: Py_Initialize: Unable to get the locale encoding
2015-03-29T09:41:24.978079+00:00 app[bot.1]: ImportError: No module named 'encodings'
2015-03-29T09:41:25.811735+00:00 heroku[bot.1]: State changed from up to crashed
2015-03-29T09:41:25.801807+00:00 heroku[bot.1]: Process exited with status 134
我尝试将运行时设置为3.4,并寻找类似问题的解决方案。一些来源说 $PYTHONPATH
必须为空,而在heroku上,$PYTHONPATH
的值为 /app//
。
这可能是一些愚蠢的错误,但我找不到它。