簡體   English   中英

heroku python3:ImportError:沒有名為“ encodings”的模塊

[英]heroku python3: ImportError: No module named 'encodings'

我一直在嘗試讓我的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 logs輸出:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM