Skip to content Skip to sidebar Skip to footer

'ascii' Codec Can't Decode Error When Use Pip To Install Uwsgi

I am setting up uwsgi following this tutorial: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html. I run pip install uwsgi within virtualenv, but get the probl

Solution 1:

It's a question asked a year ago? I come here by Google. I notice that the asker is Chinese, same as me. So, maybe we face the same problem. Oh, sorry for my bad English!

I HAVE FOUND THE RIGHT ANSWER!

It is because when Python installs some packages, it will check the Windows Registry, some Chinese software like Aliwangwang import 'gbk' value to the HKEY_CLASSES_ROOT. So Python doesn't work.

It can be solved like this:

open C:\Python27\Lib\ mimetypes.py with Notepad ++ or other editor, then search the line " default_encoding = sys.getdefaultencoding()". add codes to the line above like this:

if sys.getdefaultencoding() != 'gbk':
    reload(sys)
    sys.setdefaultencoding('gbk')
    default_encoding = sys.getdefaultencoding()

Solution 2:

Try installing first libevent-devel and python-devel

yum install libevent-devel python-devel

and then installing

pip install uwsgi

Solution 3:

I had the same problem. In my case, on top of the above suggestions I had to run:

sudo apt-get install build-essential

Solution 4:

Check that you have installed python-dev

Solution 5:

hugleecool's solution is good. Another way to solve this is to find Control Panel and change the system's non Unicode program's language.

For Chinese system, i think the default value is Chinese, you could change it to English and it will solve all the similar decode problems.

Post a Comment for "'ascii' Codec Can't Decode Error When Use Pip To Install Uwsgi"