2

コマンドラインから VisItを実行する方法を学ぼうとしています.Pythonvisit -cliコマンドを使用してプロットを作成することができましたOpenDatabase("somefile.vtk").

ipython通訳以外で同じことをする方法はありますか?

私はもう試した

import visit
visit.OpenDatabase("somefile.vtk")

これは私にエラーを与える'module' object has no attribute 'OpenDatabase'

一方、私が走ると

import visit
visit.Launch()
visit.OpenDatabase("somefile.vtk")
...

VisIt GUI が開き、それ以降visit.Launch()はすべて無視されます。

  • ビジット 2.6
  • IPython 0.13
  • Mac OS X 10.8.3

編集:

import sys
print sys.path

ipython

['',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MeshPy-2013.1-py2.7-macosx-10.8-x86_64.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytest-2.3.4-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytools-2012.1-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py-1.4.13-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/decorator-3.4.0-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.dev3763-py2.7-macosx-10.8-x86_64.egg',
 '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/Library/Python/2.7/site-packages/matplotlib-1.2.0-py2.7-macosx-10.8-intel.egg',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/site-packages',
 '/Users/lzkelley',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Users/lzkelley/Library/Python/2.7/lib/python/site-packages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyObjC',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
 '/Library/Python/2.7/site-packages',
 '/Library/Python/2.7/site-packages/PIL',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/extensions']

パイソン

['',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MeshPy-2013.1-py2.7-macosx-10.8-x86_64.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytest-2.3.4-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytools-2012.1-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py-1.4.13-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/decorator-3.4.0-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.dev3763-py2.7-macosx-10.8-x86_64.egg',
 '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/Library/Python/2.7/site-packages/matplotlib-1.2.0-py2.7-macosx-10.8-intel.egg',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/site-packages',
 '/Users/lzkelley',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Users/lzkelley/Library/Python/2.7/lib/python/site-packages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyObjC',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
 '/Library/Python/2.7/site-packages',
 '/Library/Python/2.7/site-packages/PIL']

-cli にアクセス

['',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/bin',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/site-packages',
 '/Users/lzkelley',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python26.zip',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/plat-darwin',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/plat-mac',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/plat-mac/lib-scriptpackages',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/lib-tk',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/lib-old',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/lib-dynload',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/site-packages',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/python/lib/python2.6/site-packages/PIL',
 '/Users/lzkelley/Applications/visit/VisIt.app/Contents/Resources/2.6.1/darwin-x86_64/lib/site-packages']
4

2 に答える 2

0

皆さんがこれを理解したかどうかはわかりませんが、訪問をゼロから構築しない限り、それが可能かどうかはわかりません。バイナリをダウンロードすると、独自の python がインストールされ、PYTHONPATH がリセットされ、特定のライブラリが追加されます。彼らの起動スクリプト (bin/visit) を見ると、システム python を使用するように VisIt をビルドできるはずです。その時点で、代わりにシステム ipython を使用するように勧めることができます。ただし、これは実行時ではなく、VisIt の構成時に行われます。

とはいえ、物事をハッキングする方法を見つけた場合は、私も知りたいので回答を投稿してください!

于 2013-06-23T17:38:05.397 に答える