pyo3
pyo3 copied to clipboard
pls test for import MetaTrader5-Python CPython module
[dependencies] pyo3 = { version = "0.25.1", features = ["auto-initialize"] }
use pyo3::prelude::*;
fn main() -> PyResult<()> {
Python::with_gil(|py| {
let mt5 = py.import("MetaTrader5")?;
println!("Hello {}", mt5);
Ok(())
})
}
Error: PyErr { type: <class 'ImportError'>, value: ImportError('DLL load failed while importing _core: 找不到指定的模块。'), traceback: Some("Traceback (most recent call last):\n File "D:\Python312\Lib\site-packages\MetaTrader5\init.py", line 258, in target\debug\rust-example.exe (exit code: 1)
the MetaTrader5 Python module is compiled using Cpython and is compiled with the code core.cp312-winyamd64.pyd
I encountered the same error when testing with the Go library(github.com/tliron/py4go)