Re: [問題] iperf3 for python在windows上的使用

作者: Neisseria (Neisseria)   2017-09-05 23:11:29
小弟節錄了 IPerf3 物件的程式碼如下:
class IPerf3(object):
"""The base class used by both the iperf3 :class:`Server` and :class:`Client`
.. note:: You should not use this class directly
"""
def __init__(self,
role,
verbose=True,
lib_name='libiperf.so.0'):
"""Initialise the iperf shared library
:param role: 'c' = client; 's' = server
:param verbose: enable verbose output
:param lib_name: The libiperf name providing the API to iperf3
"""
# TODO use find_library to find the best library
try:
self.lib = cdll.LoadLibrary(lib_name)
except OSError:
raise OSError('Could not find shared library {0}. Is iperf3 installed?'.format(lib_name))
# More code...
看起來你需要傳入 lib_name 參數
Windows 我比較少用,應該是傳 .dll 吧,.so 是 GNU/Linux 在用的
Python 套件應該都可以看原始碼
有時候還是要看一下,比較能夠除錯
※ 引述《jack622 (High)》之銘言:
: Python官網有提供iperf3的lib
: 小弟我抓下來使用後發現第一關就卡住了
: import iperf3 (這步沒有問題)
: client = iperf3.Client() 這步就出問題了
: 他顯示OSError:Could not find share library libiperf.so.0. Is iperf3 installed?
: 但是windows版的iperf是不用安裝的
: 只要下載檔案,然後用CMD指到該資料夾就可以開始用command line操作他
: 只有linux版的iperf需要安裝
: 請問各位大大有相關解法嗎?
:
作者: jack622 (High)   2017-09-06 11:26:00
我入門不久無法盡懂,不過會好好研究的,感謝你特地回我意思是這個lib.so.0本來就不是for windows的,然後我要找個dll的版本或是嘗試修改他的套件嗎?

Links booklink

Contact Us: admin [ a t ] ucptt.com