---
title: "How to build Aspose.Words for Python via Java"
---

To create "Aspose Words for Python via Java" package we use [JCC](https://lucene.apache.org/pylucene/jcc/index.html)

## How to build JCC on Windows

Download and install [JRE](https://www.oracle.com/java/technologies/downloads/#java8) (it is not necessary because you can use %JDK_HOME%\jre)

JCC requires [JDK](https://www.oracle.com/java/technologies/downloads/#java8) so download and install it.

Download and install [Python](https://www.python.org/ftp/python/2.7.14/python-2.7.14.amd64.msi)

Make sure Java's and Python's paths are on the environment variables list

![how-to-build-aspose-words-for-python-via-java-1](how-to-build-aspose-words-for-python-via-java-1.png)

Install wheel

```csharp
>  pip install wheel
```

Download and install [Microsoft Visual C++ Compiler for Python 2.7](https://wiki.python.org/moin/WindowsCompilers)

Download and unzip [JCC](https://pypi.org/project/JCC/)

Run following command in JCC directory

```csharp
JCC-3.0> python .\setup.py build
```

Then run install command

```csharp
JCC-3.0> python .\setup.py install
```

Check JCC egg has been installed

```csharp
    > ls C:\Python27\Lib\site-packages\JCC-3.0-py2.7-win-amd64.egg
```

## How to build JCC on Ubuntu

Check if python is installed

```csharp
> python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
```

In order to get things working make sure Java is installed, if it isn't then do following:

```csharp
> sudo add-apt-repository ppa:webupd8team/java
\> sudo apt-get update
\> sudo apt-get install oracle-java8-installer
```

Install svn

```csharp
> sudo apt install subversion
```

Check out JCC's sources

```csharp
> svn co https://svn.apache.org/repos/asf/lucene/pylucene/trunk/jcc jcc
```

Make sure that [setuptools](https://pypi.org/project/setuptools/) is installed

```csharp
> pip install setuptools
```

Run following commands

```csharp
> jcc/$ python setup.py build
\> jcc/$ python setup.py install --prefix=~/.local
```

Make sure JCC has been installed

```csharp
> ls /home/_username_/.local/lib/python2.7/site-packages
```

## How to create "Aspose Words for Python via Java" python package

Make sure Java, JCC and wheel are installed.

Then run [create_aspose_words.py](create_aspose_words.py) with appropriate arguments

```csharp
> python .\create_aspose_words.py .\Aspose.Words.jdk16.jar 17.8 aspose_words
```

The first argument is the path to the Aspose.Words jar;

The second is the version;

The third is the python module name.

Result *.whl* file will be saved in *.\dist* directory

## How to install "Aspose Words for Python via Java" on Windows

1. Download and install [JRE](https://www.oracle.com/java/technologies/downloads/#java8). We use JRE x64 version because our .whl was built for Windows x64;
1. Download and install [Python](https://www.python.org/ftp/python/2.7.14/python-2.7.14.amd64.msi). At the moment 2.7 version is used;
1. Add following path variables to the environment variables list:
![how-to-build-aspose-words-for-python-via-java-2](how-to-build-aspose-words-for-python-via-java-2.png)
1. Then install the .whl package [create_aspose_words.py](create_aspose_words.py)
```csharp
> pip install .\aspose_words-17.8-cp27-none-win_amd64.whl
```

## How to install "Aspose Words for Python via Java" on Ubuntu

Check if python is installed

```csharp
> python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
```

In order to get things working make sure Java is installed, if it isn't then do following:

```csharp
> sudo add-apt-repository ppa:webupd8team/java
\> sudo apt-get update
\> sudo apt-get install oracle-java8-installer
```

Make sure pip is installed if it isn't then

```csharp
> sudo apt install python-pip
```

Run terminal and use following command:

```csharp
> pip install --prefix=~/.local aspose_words-17.8-cp27-none-linux_x86_64.whl
```

## How to use "Aspose Words for Python via Java"

```csharp
> python
import aspose_words
aspose_words.initVM(aspose_words.CLASSPATH)
d = aspose_words.Document()
db = aspose_words.DocumentBuilder(d)
db.writeln('Hello world!')
d.save('/home/slava/test.docx')
```
