I found that Python on my Mac build with narrow-build which will raise character range error when i use the re model.
So I want to install the wide-build in my Mac.S
If you really need a "wide build" of Python 2 on OS X to support Unicode code points above 0xffff
, you'll probably have to build it yourself from source. Most distributions for OS X that I am aware of use the default "narrow build"; one exception is MacPorts which does support a wide-build variant:
sudo port install python27 +ucs4
To build Python yourself from source, download and unpack the latest Python source tarball and set appropriate configure arguments for your situation. The key one is --enable-unicode=ucs4
. For example, a minimal configuration might be:
curl -O https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xf ./Python-2.7.8.tgz
cd ./Python-2.7.8
./configure --enable-unicode=ucs4 --prefix=/path/to/install MACOSX_DEPLOYMENT_TARGET=10.9
make
make install
cd
/path/to/install/bin/python2.7
Python 2.7.8 (default, Aug 3 2014, 22:27:28) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.maxunicode 1114111
As noted by Jason, current Python 3 releases always support all Unicode characters.
If using Python3 upgrade to the latest version. In 3.3 and later:
The distinction between narrow and wide Unicode builds is dropped.
http://legacy.python.org/dev/peps/pep-0393/