How to install Windows Python package/library on linux and use it

1.8k views Asked by At

I want to install package MetaTrader5 on my Linux [Fedora], but this package is supported only for Windows.

And my question is: Is it possible to install Windows Python packages on Linux? and after installation import in my python file?


My Solution

  1. install wine (learn more about wine)
  2. download python for windows, than install with wine <path to .exe>
  3. wine pip install MetaTrader5 or another windows only library
  4. (example) create virtual enviroment wine venv <name project> and select
  5. than import library to file, install package [3] in your virtual enviroment and you can you use it.
  6. run with wine python <file.py>
2

There are 2 answers

0
fayez On

you can install wine to deal with the windows installer files in your fedora.

as per the doc, you can run the following comands one by one to install wine:

sudo dnf clean all && sudo dnf update

dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/32/winehq.repo

sudo dnf install winehq-stable

after that, to confirm the installation: run wine --version , this should be executed without any error.

lastly, dowmload the mt5setup.exe and open it with wine.

also, have a look at this answer: https://stackoverflow.com/a/44031808/10918344

hope you find it helpful

0
Timur U On

Yes it possible to use Wine. Its simply to do with CrossOver, its more stable. Meta Trader compiled for the Wine. Ive use this thing. Work correctly Meta Trader and Meta editor.