Python to install a third-party module, you can use the Easy_install ' module name ' to install the module directly, but I encountered an error when installing Easy_install unicodedecodeerror: ' ASCII ' codec can ' t Decode byte
Download Ez_setup.py:https://pypi.python.org/pypi/setuptools#windows to a directory first
CMD->CD to the downloaded directory
<span style= "FONT-SIZE:18PX;" >python ez_setup.py</span>
This time if there is no error, Easy_install installed, you can see C:\Python27\ a script this directory, below the Easy_install.exe, so the next step is to add this directory to the system variable path
After that, you can run Easy_install directly on the command line, but in this place, there will be title errors, for reasons related to the registry, and possibly the GBK format that some native software may overwrite the registry, resulting in Python's inability to install third-party libraries.
Workaround: Open the mimetypes.py file under C:\Python27\Lib and find about 256 lines (you can use the notepad++ search function)
' default_encoding = sys.getdefaultencoding () '.
Add three lines in front of this line: (note indent)
<span style= "FONT-SIZE:18PX;" >if sys.getdefaultencoding ()! = ' GBK ': reload (SYS) sys.setdefaultencoding (' GBK ') default_encoding = Sys.getdefaultencoding () </span>
Save, run again, for example, we want to install an image processing module, this module is called PiL
<span style= "FONT-SIZE:18PX;" >easy_install pil</span>
OK, error resolved.
Python Install third-party module Unicodedecodeerror: ' ASCII ' codec can ' t decode byte