我最近重新安装了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。在这里我能做些什么?
发布于 2021-09-07 13:14:57
我在Debian服务器上也面临着同样的问题,对我来说,问题是我把我的项目放在了/root/
文件夹中,mod_wsgi没有访问该文件夹的权限。因此,我只需将我的项目移到/var/www/html/
中并更新我的VirtualHost配置。
https://stackoverflow.com/questions/38132755
复制相似问题