heroku python3:ImportError:没有名为’encodings’的模块
发布时间:2020-12-20 13:48:20 所属栏目:Python 来源:网络整理
导读:我一直试图让我的 python3 reddit bot在heroku上工作一段时间,但我一直遇到这个错误: ~ $python3Fatal Python error: Py_Initialize: Unable to get the locale encodingImportError: No module named 'encodings'Aborted (core dumped) 当我在远程bash会话
我一直试图让我的
python3 reddit bot在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 //. 这可能是一些愚蠢的错误,但我找不到它. 解决方法
您需要在runtime.txt文件中指定您的python版本.
https://devcenter.heroku.com/articles/python-runtimes 然后在推动你会看到: 遥控器:—–>找到python-2.7.13,删除 遥控器:—–>安装python-3.6.1 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |