【问题标题】:fatal python error :py_Initialize : unable to get the locale encodings import error: no module named encodings致命的python错误:py_Initialize:无法获取语言环境编码导入错误:没有名为编码的模块
【发布时间】:2019-08-31 12:12:14
【问题描述】:

错误信息的重要部分: 我收到以下错误 starting uWSGI 2.0.18 setting pythonHome to /var/www/demo/venv python version :3.5.3 Fatal Python error :unable to get the locale encoding import error : no module named 'encodings' 它显示python版本:3.5.3 但是在我的 venv/lib 文件夹中,只有一个包 python 2.7 这与我的错误有关吗?

请帮帮我。

这是我的 demo_uwsgi.ini 文件

#application's base folder
base = /var/www/demo

#python module to import
app = flaskfile     //flaskfile is my flask file
module = %(app)

home = %(base)/venv
pythonpath = %(base)

#socket file's location
socket = /var/www/demo/%n.sock

#permissions for the socket file
chmod-socket    = 666

#the variable that holds a flask application inside the module imported at line #6
callable = app

#location of log files
logto = /var/log/uwsgi/%n.log```

Am I missing plugins or something? I added plugins = python32 in my demo_uwsgi.ini file and it shows no such file or directory. Do I need to change or unset python path or something?

【问题讨论】:

    标签: python-3.x nginx uwsgi


    【解决方案1】:

    我自己想通了。删除默认的 Nginx 配置文件并在 /etc/nginx.conf 中添加新的配置文件。然后按照此链接https://vladikk.com/20.13/09/12/serving-flask-with-nginx-on-ubuntu/ 中的说明逐步操作。将所有权从 root 更改为用户。效果很好

    【讨论】:

      猜你喜欢
      • 2020-03-09
      • 2014-01-16
      • 1970-01-01
      • 1970-01-01
      • 2017-01-03
      • 2020-07-03
      • 2015-08-26
      • 1970-01-01
      • 2013-05-06
      相关资源
      最近更新 更多