简体   繁体   中英

How to run an executable file in python on Raspbian?

Hello i'm been having some trouble with run a exe file on python. I'm using a Raspberry Pi and have not been able to find an answer that works. I've tried to use subprocess

import subprocess
subprocess.Popen("/home/pi/Desktop/file.exe")

only to get [Errno 8] Exec format error. I get the same thing with subprocess.call.

I tried to use os

import os
os.system("/home/pi/Desktop/file.exe")

I get no errors there but nothing happens.

I know the exe file works when I click on it, I know that the file path is correct. Is there anyway I could run this exe with my python program.

Okay, .exe files are windows executables. They are not compiled for Linux (Raspian) at all. however you can find the extension of your file by opening a terminal window, navigate to the desktop with cd ~/Desktop/ Then run ls -la to list the folder contents.

On the other hand, if you are meaning a Python file to run then it will have the extension .py . To run these open up your terminal and navigate to your Desktop again using cd ~/Desktop/ and run it with python file.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM