我最近重新安裝的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
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好幾次了。我能從這裏做什麼?謝謝
這是關係到Django還是Python?你可能想用適當的標籤編輯你的問題。 –
只是蟒蛇,我碰巧正在使用Django – codyc4321
這似乎是蟒蛇安裝不完整。你是否通過apt安裝了python,或者你是否從源代碼編譯並安裝了它?運行'哪個python'來檢查你在$ PATH中的第一個python二進制文件。 – HAL