OpenCC Python Extension with no external dependencies for Linux OSX and Windows
This readme is for Visual studio 2013 or higher. And you need to install cmake.
First of all check the python version you want. like: 64bit or 32bit, 2.7.9 or 3.3.3 or 3.4.2. Use python -version to check. Make sure that the python version you need is current aviable from path.
##Clone the repo
git clone -b windows https://github.com/rexdf/OpenCC_Python.git
cd OpenCC_Python
git submodule init
git submodule update
##Build
-
go to
OpenCC_Python\OpenCC, run__run_cmake x64.bator__run_cmake x86.bat(or both). -
If everything goes well, you find one or two more folders
OpenCC_32andOpenCC_64. -
Open
_OpenCC.slnin the above folder with Visual studio 2013 or higher. Change to Release and build. Close it now.
- Now you need open
VS2013 x86 Native Tools Command PromptorVS2013 x64 Native Tools Command PromptorVS2013 x64 Cross Tools Command Promptfrom your start menu(or metro/modern UI). - run
path=D:\python33_64;%path%to add python you need to your path. - run
set DISTUTILS_USE_SDK=1andset MSSdk=1 - now cd to
OpenCC_Pythonfolder. - python setup.py build
- Copy
_OpenCC.pydfromOpenCC_Python\build\lib.win-amd64-3.3toOpenCC_Python\out. (You need to build a out inOpenCC_Python. - copy all json files from
OpenCC_Python\OpenCC\data\configtoOpenCC_Python\out. - copy correct arch(32 or 64) ocd from
OpenCC_Python\OpenCC\OpenCC_32\dataorOpenCC_Python\OpenCC\OpenCC_64\datatoOpenCC_Python\out.
##Test Now you can run some test.(copy files is required before Test)
cd OpenCC_Python
python test.py
For Linux or OSX build, Please refer here.