简体   繁体   中英

How to recompile Python2.7 with 4-byte unicode enabled?

I have tried ./configure --enable-unicode and ./configure --enable-unicode=ucs4 but the command import sys; print sys.maxunicode import sys; print sys.maxunicode is still 65535.

How should I fix this and compile Python with 4-byte unicode enabled?

From the output of

./configure --help

the correct option is given as

--enable-unicode=ucs4

We can re-compile already installed python with 4-byte Unicode or 2-byte Unicode

Full Flow after downloading python2.7.x and extracting it.

  1. go to directory Python2.7.x (in my case it is Python2.7.10)

2.fire command "sudo ./configure --enable-unicode=ucs4" or "sudo ./configure --enable-unicode=ucs2" which ever you want.

now you can check if it is UCS2 or UCS4 as below 1.go to terminal

2.type python and enter now enter following commands

import sys print sys.maxunicode

if output is 1114111 then it is UCS4 otherwise if output is 65535 then it is UCS2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM