我最近重新安装了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几次。我可以从这里做什么?谢谢
which python
以检查您首先在$ PATH中拥有哪个python二进制文件。