作者:tycomed姐姐_398 | 来源:互联网 | 2023-07-28 11:30
某些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
>>>