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.So how can I install Python with wide-build on Mac?
Install Python 3 with the Official Installer First, download an installer package from the Python website. To do that, visit https://www.python.org/downloads/ on your Mac; it detects your operating system automatically and shows a big button for downloading the latest version of Python installer on your Mac.
Python comes pre-installed on Mac OS X so it is easy to start using. However, to take advantage of the latest versions of Python, you will need to download and install newer versions alongside the system ones.
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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With