install.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>1. Installing Py4J &mdash; Py4J</title>
  7. <link rel="stylesheet" href="_static/py4jdoc.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '0.8.1',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: 'true'
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/underscore.js"></script>
  20. <script type="text/javascript" src="_static/doctools.js"></script>
  21. <link rel="author" title="About these documents" href="about.html" />
  22. <link rel="top" title="Py4J" href="index.html" />
  23. <link rel="next" title="2. Getting Started with Py4J" href="getting_started.html" />
  24. <link rel="prev" title="Py4J Documentation" href="contents.html" />
  25. <script type="text/javascript">
  26. var _gaq = _gaq || [];
  27. _gaq.push(['_setAccount', 'UA-18626179-1']);
  28. _gaq.push(['_trackPageview']);
  29. (function() {
  30. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  31. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  32. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  33. })();
  34. </script>
  35. </head>
  36. <body>
  37. <div class="page">
  38. <div class="banner">Py4J - A Bridge between Python and Java</div>
  39. <div class="related">
  40. <h3>Navigation</h3>
  41. <ul>
  42. <li class="right" style="margin-right: 5px">
  43. <a href="genindex.html" title="General Index"
  44. accesskey="I">index</a></li>
  45. <li class="right" >
  46. <a href="py-modindex.html" title="Python Module Index"
  47. >modules</a> |</li>
  48. <li class="right" >
  49. <a href="getting_started.html" title="2. Getting Started with Py4J"
  50. accesskey="N">next</a> |</li>
  51. <li class="right" >
  52. <a href="contents.html" title="Py4J Documentation"
  53. accesskey="P">previous</a> |</li>
  54. <li><a href="index.html">Home</a> |</li>
  55. <li><a href="download.html">Download</a> |</li>
  56. <li><a href="contents.html">Doc</a> |</li>
  57. <li><a href="https://blog.py4j.org">Blog</a> |</li>
  58. <li><a href="https://github.com/bartdag/py4j">github</a> |</li>
  59. <li><a href="about.html">About</a> &raquo;</li>
  60. </ul>
  61. </div>
  62. <div class="sphinxsidebar">
  63. <div class="sphinxsidebarwrapper">
  64. <h3><a href="contents.html">On This Page</a></h3>
  65. <ul>
  66. <li><a class="reference internal" href="#">1. Installing Py4J</a><ul>
  67. <li><a class="reference internal" href="#installing-python-2-6-or-3-4">1.1. Installing Python 2.6+ or 3.4</a></li>
  68. <li><a class="reference internal" href="#installing-java-6">1.2. Installing Java 6+</a></li>
  69. <li><a class="reference internal" href="#id1">1.3. Installing Py4J</a><ul>
  70. <li><a class="reference internal" href="#using-easy-install-or-pip">1.3.1. Using easy_install or pip</a></li>
  71. <li><a class="reference internal" href="#using-an-official-release">1.3.2. Using an official release</a></li>
  72. <li><a class="reference internal" href="#using-the-latest-development-source-code">1.3.3. Using the latest development source code</a></li>
  73. <li><a class="reference internal" href="#maven-install">1.3.4. Maven install</a></li>
  74. </ul>
  75. </li>
  76. </ul>
  77. </li>
  78. </ul>
  79. <h4>Previous topic</h4>
  80. <p class="topless"><a href="contents.html"
  81. title="previous chapter">Py4J Documentation</a></p>
  82. <h4>Next topic</h4>
  83. <p class="topless"><a href="getting_started.html"
  84. title="next chapter">2. Getting Started with Py4J</a></p>
  85. <h3>This Page</h3>
  86. <ul class="this-page-menu">
  87. <li><a href="_sources/install.txt"
  88. rel="nofollow">Show Source</a></li>
  89. </ul>
  90. <div id="searchbox" style="display: none">
  91. <h3>Quick search</h3>
  92. <form class="search" action="search.html" method="get">
  93. <input type="text" name="q" size="18" />
  94. <input type="submit" value="Go" />
  95. <input type="hidden" name="check_keywords" value="yes" />
  96. <input type="hidden" name="area" value="default" />
  97. </form>
  98. <p class="searchtip" style="font-size: 90%">
  99. Enter search terms or a module, class or function name.
  100. </p>
  101. </div>
  102. <script type="text/javascript">$('#searchbox').show(0);</script>
  103. </div>
  104. </div>
  105. <div class="document">
  106. <div class="documentwrapper">
  107. <div class="bodywrapper">
  108. <div class="body">
  109. <div class="section" id="installing-py4j">
  110. <span id="install-instructions"></span><h1>1. Installing Py4J<a class="headerlink" href="#installing-py4j" title="Permalink to this headline">¶</a></h1>
  111. <div class="section" id="installing-python-2-6-or-3-4">
  112. <h2>1.1. Installing Python 2.6+ or 3.4<a class="headerlink" href="#installing-python-2-6-or-3-4" title="Permalink to this headline">¶</a></h2>
  113. <p>Py4J is a library written in Python and Java. Currently, Py4J has been tested
  114. with Python 2.6, 2.7, and 3.4, but it should also be compatible with Python 3.3.
  115. You can install Python by going to the <a class="reference external" href="http://www.python.org/download/">official Python download page</a>.</p>
  116. </div>
  117. <div class="section" id="installing-java-6">
  118. <h2>1.2. Installing Java 6+<a class="headerlink" href="#installing-java-6" title="Permalink to this headline">¶</a></h2>
  119. <p>You also need to install a Java environment, version 6 (7 and 8 are also
  120. supported). You can install a Java environment by going to the <a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">official Java
  121. download page</a> You will
  122. need to download the JDK if you plan to use the Java compiler, but you only
  123. need the JRE if you are using another compiler, such as the one provided by the
  124. <a class="reference external" href="http://www.eclipse.org">Eclipse Development Environment</a>.</p>
  125. </div>
  126. <div class="section" id="id1">
  127. <h2>1.3. Installing Py4J<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
  128. <p>There are three ways to install Py4J:</p>
  129. <div class="section" id="using-easy-install-or-pip">
  130. <h3>1.3.1. Using easy_install or pip<a class="headerlink" href="#using-easy-install-or-pip" title="Permalink to this headline">¶</a></h3>
  131. <ol class="arabic simple">
  132. <li>Run <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">py4j</span></code> or <code class="docutils literal"><span class="pre">easy_install</span> <span class="pre">py4j</span></code> (don&#8217;t forget
  133. to prefix with sudo if you install Py4J system-wide on a
  134. *NIX operating system).</li>
  135. <li>Py4J should now be in your PYTHONPATH.</li>
  136. <li>The Py4J Java library is located in <code class="docutils literal"><span class="pre">share/py4j/py4j0.x.jar</span></code>. The exact
  137. location depends on the platform and the installation type. Some likely
  138. locations are:<ol class="arabic">
  139. <li><code class="docutils literal"><span class="pre">/usr/share/py4j/py4j0.x.jar</span></code> for system-wide install on Linux.</li>
  140. <li><code class="docutils literal"><span class="pre">{virtual_env_dir}/share/py4j/py4j0.x.jar</span></code> for installation in a
  141. virtual environment.</li>
  142. <li><code class="docutils literal"><span class="pre">C:\python27\share\py4j\py4j0.x.jar</span></code> for system-wide install on
  143. Windows.</li>
  144. </ol>
  145. </li>
  146. </ol>
  147. </div>
  148. <div class="section" id="using-an-official-release">
  149. <h3>1.3.2. Using an official release<a class="headerlink" href="#using-an-official-release" title="Permalink to this headline">¶</a></h3>
  150. <ol class="arabic simple">
  151. <li>Download the latest official release from from <a class="reference external" href="http://pypi.python.org/pypi/py4j">PyPI</a>. If you are using a *NIX OS, download
  152. the tar.gz file. If you are using Windows, download the zip file.</li>
  153. <li>Untar/Unzip the file and navigate to the newly created directory, e.g., <code class="docutils literal"><span class="pre">cd</span>
  154. <span class="pre">py4j-0.x</span></code>.</li>
  155. <li>Run <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></code> (don&#8217;t forget to prefix with sudo if you
  156. install Py4J system-wide).</li>
  157. <li>Py4J should now be in your PYTHONPATH.</li>
  158. <li>The Py4J Java library is located under <code class="docutils literal"><span class="pre">py4j-java/py4j0.x.jar</span></code>. Add this
  159. library to your classpath when using Py4J in a Java program.</li>
  160. </ol>
  161. </div>
  162. <div class="section" id="using-the-latest-development-source-code">
  163. <h3>1.3.3. Using the latest development source code<a class="headerlink" href="#using-the-latest-development-source-code" title="Permalink to this headline">¶</a></h3>
  164. <p>You can install the latest version with pip and git:
  165. <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">git+https://github.com/bartdag/py4j.git</span></code></p>
  166. <p>Otherwise, to build the Java and Python libraries, you need:</p>
  167. <ol class="arabic simple">
  168. <li><a class="reference external" href="http://git-scm.com/">Git</a> to download the latest source code.
  169. Execute the command line <code class="docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">https://github.com/bartdag/py4j.git</span>
  170. <span class="pre">py4j</span></code> to download the source code.</li>
  171. <li><a class="reference external" href="http://ant.apache.org">Apache ant</a> to build the Py4J Java library execute
  172. the command line <code class="docutils literal"><span class="pre">ant</span> <span class="pre">jar</span></code> in the py4j-java project directory to build the
  173. code and create a jar file.</li>
  174. <li><a class="reference external" href="http://sphinx.pocoo.org/">Sphinx</a> to build the documentation. Just
  175. execute the command line <code class="docutils literal"><span class="pre">make</span> <span class="pre">html</span></code> in the
  176. py4j-web project.</li>
  177. <li><a class="reference external" href="http://pypi.python.org/pypi/nose/">nose</a> to test the Py4J Python
  178. library.</li>
  179. </ol>
  180. <p>Execute the command line <code class="docutils literal"><span class="pre">ant</span> <span class="pre">python-light-release</span></code> in the py4j-java
  181. directory to create a tar.gz and zip source distribution. The
  182. <code class="docutils literal"><span class="pre">python-light-release</span></code> target will (1) build the Py4J Java library, (2)
  183. build the documentation, and (3) build the Py4J Python library and package it
  184. into a tar.gz and zip source distribution.</p>
  185. </div>
  186. <div class="section" id="maven-install">
  187. <h3>1.3.4. Maven install<a class="headerlink" href="#maven-install" title="Permalink to this headline">¶</a></h3>
  188. <ol class="arabic simple">
  189. <li>Download the source code as explained above.</li>
  190. <li>Go to the py4j-java directory and execute <code class="docutils literal"><span class="pre">mvn</span> <span class="pre">install</span></code>.</li>
  191. <li>Alternatively, if a test fails (possible because of sockets), execute
  192. <code class="docutils literal"><span class="pre">mvn</span> <span class="pre">-Dmaven.test.skip=true</span> <span class="pre">install</span></code></li>
  193. <li>Builded binaries will be in the directory <code class="docutils literal"><span class="pre">target/py4j-0.x.jar</span></code>.</li>
  194. </ol>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="helpbar">
  200. <h3>Questions/Feedback?</h3>
  201. <ul>
  202. <li>Try the <a href="faq.html">FAQ</a> -- It answers many questions.</li>
  203. <li>Search for information in the <a href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j">archives of the py4j-users mailing list</a>, or <a href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j/join">post a question</a>.</li>
  204. <li>If you notice errors with this documentation, <a href="https://github.com/bartdag/py4j/issues">open a ticket</a> and let us know. Please, only open a ticket for feedback or improvements on the docs. To get help, use the links above!</li>
  205. </ul>
  206. </div>
  207. </div>
  208. </div>
  209. <div class="clearer"></div>
  210. </div>
  211. <div class="related">
  212. <h3>Navigation</h3>
  213. <ul>
  214. <li class="right" style="margin-right: 5px">
  215. <a href="genindex.html" title="General Index"
  216. >index</a></li>
  217. <li class="right" >
  218. <a href="py-modindex.html" title="Python Module Index"
  219. >modules</a> |</li>
  220. <li class="right" >
  221. <a href="getting_started.html" title="2. Getting Started with Py4J"
  222. >next</a> |</li>
  223. <li class="right" >
  224. <a href="contents.html" title="Py4J Documentation"
  225. >previous</a> |</li>
  226. <li><a href="index.html">Home</a> |</li>
  227. <li><a href="download.html">Download</a> |</li>
  228. <li><a href="contents.html">Doc</a> |</li>
  229. <li><a href="https://blog.py4j.org">Blog</a> |</li>
  230. <li><a href="https://github.com/bartdag/py4j">github</a> |</li>
  231. <li><a href="about.html">About</a> &raquo;</li>
  232. </ul>
  233. </div>
  234. <div class="footer">
  235. &copy; Copyright 2009-2013, Barthélémy Dagenais.
  236. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.1.
  237. </div>
  238. </div>
  239. </body>
  240. </html>