[Solved]-'ascii' codec can't decode error when use pip to install uwsgi

17👍

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()

16👍

Try installing first libevent-devel and python-devel

yum install libevent-devel python-devel

and then installing

pip install uwsgi
👤leela

4👍

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

sudo apt-get install build-essential

4👍

Check that you have installed python-dev

0👍

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.

Leave a comment