Warum setzen Sie nicht "usercustomize.py", bevor Sie "sitecustomize.py" setzen?
python
>>> import site
>>> userdir = site.getusersitepackages()
windows
>>> userdir()
'C:\\Users\\owner\\AppData\\Roaming\\Python\\Python27\\site-packages'
ubuntu
>>> userdir()
'/home/owner/.local/lib/python2.7/site-packages'
mac
>>> userdir()
'/Users/owner/Library/Python/2.7/lib/python/site-packages'
windows
>>> os.makedirs(userdir)
>>> os.system('explorer.exe %s' % userdir)
1
windows
>>> f = open("%s\\usercustomize.py" % userdir,"w")
>>> str="""import sys
... sys.setdefaultencoding('utf-8')
... """
>>> f.write(str)
>>> f.close()
python
>>> import sys
>>> sys.getdefaultencoding()
'utf-8'
Wenn dies fehlschlägt, wird "ascii" angezeigt.
Recommended Posts