我最近重新安装了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好几次了。从这里我可以做什么?
对于 Python-3,请尝试删除虚拟环境文件。并重新设置它。
rm -rf venv
virtualenv -p /usr/bin/python3 venv/
source venv/bin/activate
pip install -r requirements.txt
https://wiki.ubuntu.com/XenialXerus/ReleaseNotes#Python_3 https://wiki.ubuntu.com/XenialXerus/ReleaseNotes#Python_3
edit fo
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)