Learning machine learning problems arise, Baidu has not finished a half-day, but know the reason for the following reasons:
Because Python uses ASCII encoding by default, and when Python converts between encodings, the Unicode As an "intermediate code", but Unicode is only 128 that long, so this error is reported here when attempting to convert an ASCII-encoded string to "intermediate encoded" Unicode because it is out of range.
Now that you know the reason, it's OK. Not
The workaround is as follows:
1. Modify the default encoding format: For example # encoding =utf-8
2. In/usr/lib/python2.7/ Add a sitecustomize.py file under the site-packages/directory with the following contents:
import syssys.setdefaultencoding ( ' Utf-8
3. I haven't tried the above method, but I feel I can. It is in principle a modified encoding format for all files.
But the reason I was wrong is that the path has Chinese ... Change to English is good, if have the same situation may wish to try the
Python run code appears ' ASCII ' codec can ' t decode byte 0xb4 in position 11:ordinal not in range (+)
/span>