根据我的阅读,sys.path 应该由 PYTHONPATH 设置。在 Python 中,它以这种方式工作,但在 Jython 中则不然。我可以绕过,-Dpython.path=...
但我想知道为什么 Jython 玩得不好。
qa@Scantron:/tmp/pip-build-qa/robotframework> echo $PYTHONPATH
/usr/lib64/python2.7
qa@Scantron:/tmp/pip-build-qa/robotframework> jython
Jython 2.2.1 on java1.7.0_17
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/share/jython/Lib', '__classpath__']
>>> ^D
qa@Scantron:/tmp/pip-build-qa/robotframework> jython -Dpython.path=/usr/lib64/python2.7
Jython 2.2.1 on java1.7.0_17
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/share/jython/Lib', '/usr/lib64/python2.7', '__classpath__']