Re: [問題] iperf3 for python在windows上的使用已刪文
小弟節錄了 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需要安裝
: 請問各位大大有相關解法嗎?
: -----
: Sent from JPTT on my HTC_A9u.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.182.141.81
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1504624292.A.740.html
推
09/06 11:26, , 1F
09/06 11:26, 1F
推
09/06 11:30, , 2F
09/06 11:30, 2F
→
09/06 11:30, , 3F
09/06 11:30, 3F
這個 Python 套件內沒有自帶 IPerf3 函式庫,要另外下載安裝
Windows 會從 PATH 裡找 DLL,應該不用特別指定位置
應該吧,我後來比較沒有用 Windows,要另問高人
※ 編輯: Neisseria (203.71.94.20), 09/06/2017 13:02:31
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):