我最近重新安装了 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。我能从这里做什么?谢谢