Using ez_setup.py installation Setuptools error is as follows
Traceback (most recent): File "httpservice.py", line 5, <module> import simplehttpserver File "C:\Python27\lib\SimpleHTTPServer.py", line +, in <module> class Simplehttprequesthandler ( Basehttpserver.basehttprequesthandler): File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in Simplehttprequesthandler Mimetypes.init () # try to read system mime.types File "C:\Python27\lib\mimetypes.py" , Line 358, in Init db.read_windows_registry () File "C:\Python27\lib\mimetypes.py", line 258, in Read_windows_ Registry for SubkeyName in Enum_types (HKCR): File "C:\Python27\lib\mimetypes.py", line 249, in Enum_types CType = Ctype.encode (default_encoding) # Omit in 3.x! Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb0 in position 1:ordinal not in range (128)
Workaround:
Through the analysis of the last error prompt, is due to the Setuptools package in the setup.py encoding format error, resulting in unable to install, although the above error, but Setuptools-5.5.zip has been downloaded to complete. Then you can install the Setuptools package by hand:
1, decompression setuptools-5.5.zip to C:\Python27\Lib\site-packages\setuptools-5.5
2, modify the setup.py, add the following sentence in the code:
Modify the default encoding method
Import Sys
Reload (SYS)
Sys.setdefaultencoding (' GB18030 ')
3, at the same time, open the Python Lib folder under the mimetypes.py file, find about 256 lines of
' default_encoding = sys.getdefaultencoding () '.
Add three lines in front of this line:
- If sys.getdefaultencoding ()! = ' GBK ':
- Reload (SYS)
- Sys.setdefaultencoding (' GBK ')
- default_encoding = sys.getdefaultencoding ()
Reference: http://blog.csdn.net/scape1989/article/details/24535441
4, enter the python27\lib\site-packages\setuptools-5.5 directory in the cmd window, then enter: Python setup.py install, can be installed successfully
5. The scripts directory will then be generated in the Python installation directory, with Easy_install.exe
6. Set environment variables.
My Computer → right-click → properties → advanced → environment variable, inside the path value, add c:\Python27\Scripts
Finally, you can run Easy_install at the command line.