某些Python模块(如)lxml在C中具有必需的组件。它们在Jython中不起作用。
大多数Python软件包都可以正常运行,您可以使用与CPython相同的工具来安装它们。在Jython Book的附录A中对此进行了描述:
要获取setuptools,请从http://peak.telecommunity.com/dist/ez_setup.py下载ez_setup.py 。然后,转到您保留下载文件的目录并执行:
$ jython ez_setup.py
[easy_install脚本将被安装到] Jython安装的bin目录中(/home/lsoto/jython2.5.0/bin在上面的示例中)。如果您经常使用Jython,则最好将此目录添加到PATH环境变量中,因此不必每次都要使用easy_install或其他安装到此目录的脚本来键入整个路径。
在Jython中安装setuptools之后,自己进行测试,pip正确安装:
$ sudo /usr/bin/jython2.5.2b1/bin/easy_install pip
Searching for pip
[...]
Installing pip-2.5 script to /usr/bin/jython2.5.2b1/bin
Installing pip script to /usr/bin/jython2.5.2b1/bin
Installed /usr/bin/jython2.5.2b1/Lib/site-packages/pip-1.0.2-py2.5.egg
Processing dependencies for pip
Finished processing dependencies for pip
$ sudo /usr/bin/jython2.5.2b1/bin/pip install bottle
Downloading/unpacking bottle
Downloading bottle-0.9.6.tar.gz (45Kb): 45Kb downloaded
Running setup.py egg_info for package bottle
Installing collected packages: bottle
Running setup.py install for bottle
Successfully installed bottle
Cleaning up...
$ jython
Jython 2.5.2b1 (Release_2_5_2beta1:7075, Jun 28 2010, 07:44:20)
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> import bottle
>>> bottle
>>>