[英]How do I set the Environment variables for Jython?
I have set the variables JYTHON_HOME
to the directory where I have installed Jython and JYTHON_PATH
to the bin folder, but I still get the following error when I try to run jython: 我已将变量
JYTHON_HOME
设置为我已将Jython和JYTHON_PATH
安装到bin文件夹的目录,但是当我尝试运行jython时仍然出现以下错误:
'jython' is not recognized as an internal or external command,
operable program or batch file.
Why do I get this error? 为什么我会收到此错误? The Java installation has no issues.
Java安装没有问题。
You still need to add the path to the executable jython.bat to your PATH environment variable. 您仍然需要将可执行文件jython.bat的路径添加到PATH环境变量中。 Here as an example I'm providing my ini-jython.bat, which I use before executing my jython project (in this case it's a Django on Jython project, you can safely ignore the Django stuff, or adapt it to your needs):
这里作为一个例子,我提供了我的ini-jython.bat,我在执行我的jython项目之前使用它(在这种情况下,它是一个关于Jython项目的Django,你可以安全地忽略Django的东西,或者根据你的需要调整它):
set JYTHON_HOME=c:\tools\jython2.5.2
set PATH=%JYTHON_HOME%\bin;%PATH%
set CLASSPATH=dep1;dep1/lib/*;_lib/*
set JYTHONPATH=.;..\django-debug-toolbar;..\django-common
set DJANGO_SETTINGS_MODULE=site_projname.settings
set PYTHONPATH=%JYTHONPATH%
set manage=jython c:\tools\jython2.5.2\bin\django-admin.py
set makemessages=django-admin makemessages --extension html,py
set compilemessages=django-admin compilemessages
I am Windows user & I have installed Jython in C:\\jython2.7.0
. 我是Windows用户,我在
C:\\jython2.7.0
安装了Jython。
I had niether set the JYTHON_HOME
environment variable nor added %JYTHON_HOME%\\bin
to PATH
environment variable. 我没有设置
JYTHON_HOME
环境变量,也没有将%JYTHON_HOME%\\bin
添加到PATH
环境变量中。 I also got the same error as shown in the question. 我也得到了问题中显示的相同错误。
JYTHON_HOME
with value C:\\jython2.7.0
. JYTHON_HOME
新环境变量,其值为C:\\jython2.7.0
。
You've to use your own Jython's installation folder.
您将使用自己的Jython安装文件夹。
%JYTHON_HOME%\\bin
to PATH
environment variable as the below 2 image shows. %JYTHON_HOME%\\bin
添加到PATH
环境变量,如下图2所示。
Create new PATH environment variable if it is not already there (This is rare case).
如果它尚不存在,则创建新的PATH环境变量(这种情况很少见)。
jython
, it will work. jython
,它会起作用。 Now you can try executing simple Python statements as the below image shows. Do not use the already opened Terminal.
不要使用已打开的终端。
That's it. 而已。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.