最佳答案
我最近重新安装了 ubuntu,升级到了16.04,不能使用 python:
$ python manage.py runserver
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
在这一点上,python 本身不工作
$ python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
即便是这个建议也不再奏效:
unset PYTHONHOME
unset PYTHONPATH
每次我用一种方法修复它,它又会回来。有几个答案可以暂时解决这个问题,但不是永久性的。我已经重新安装了几次 python 和 python3。我在这里能做什么?