How to fix 'ImportError: No module named pssevrsn'
How to fix 'ImportError: No module named pssevrsn'
尝试使用python调用psse。但是导入 dyntools 有问题。
from __future__ import division
import os, sys, math, csv, time
PSSPY_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY27'
PSSE_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSBIN'
sys.path.append(PSSPY_location)
os.environ['PATH'] += ';' + PSSPY_location
os.environ['PATH'] += ';' + PSSE_location
import socket
import struct
import numpy, copy
import initialize_mute as mt # mute all psse outputs
# import psse34
import dyntools
import psspy
import redirect
import dyntools
File ".\dyntools.py", line 51, in <module>
ImportError: No module named pssevrsn
进程已完成,退出代码为 1
PSSE 手册指出您需要在脚本中定义 PSSPY_location
和 PSSE_location
,但这里有另一个选项可以告诉 Python 您的 PSSE 安装位置。
在 Python 安装的 site-packages
目录中创建一个扩展名为 .pth
的文件(例如 __psspy__.pth
)。这对您来说可能是 C:\Python27\Lib\site-packages\__psspy.pth__
。此文件的 内容 将只是 C:\Program Files (x86)\PTI\PSSE34\PSSPY27
。每当您启动 python 解释器时,它都会在此目录中查找 .pth
文件中包含的路径,并在您进行 import
语句时在这些位置查找 python 模块。
那么你的脚本应该是这样的:
import psse34
import psspy
import dyntools
import redirect
如果您仍然无法导入 dyntools
,请确保它位于应有的位置,即 C:\Program Files (x86)\PTI\PSSE34\PSSPY27\dyntools.pyc
对于 PSSE v34,请记住在导入任何其他 PSSE 相关 python 模块之前始终执行 import psse34
。
我将 pssevrsn 从 Bin 目录复制到 Python27 目录,它没有为我出错。
我希望它适用于
尝试使用python调用psse。但是导入 dyntools 有问题。
from __future__ import division
import os, sys, math, csv, time
PSSPY_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY27'
PSSE_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSBIN'
sys.path.append(PSSPY_location)
os.environ['PATH'] += ';' + PSSPY_location
os.environ['PATH'] += ';' + PSSE_location
import socket
import struct
import numpy, copy
import initialize_mute as mt # mute all psse outputs
# import psse34
import dyntools
import psspy
import redirect
import dyntools
File ".\dyntools.py", line 51, in <module>
ImportError: No module named pssevrsn
进程已完成,退出代码为 1
PSSE 手册指出您需要在脚本中定义 PSSPY_location
和 PSSE_location
,但这里有另一个选项可以告诉 Python 您的 PSSE 安装位置。
在 Python 安装的 site-packages
目录中创建一个扩展名为 .pth
的文件(例如 __psspy__.pth
)。这对您来说可能是 C:\Python27\Lib\site-packages\__psspy.pth__
。此文件的 内容 将只是 C:\Program Files (x86)\PTI\PSSE34\PSSPY27
。每当您启动 python 解释器时,它都会在此目录中查找 .pth
文件中包含的路径,并在您进行 import
语句时在这些位置查找 python 模块。
那么你的脚本应该是这样的:
import psse34
import psspy
import dyntools
import redirect
如果您仍然无法导入 dyntools
,请确保它位于应有的位置,即 C:\Program Files (x86)\PTI\PSSE34\PSSPY27\dyntools.pyc
对于 PSSE v34,请记住在导入任何其他 PSSE 相关 python 模块之前始终执行 import psse34
。
我将 pssevrsn 从 Bin 目录复制到 Python27 目录,它没有为我出错。 我希望它适用于