Skip to content
Sign upLog in

How to convert Python to C++?

Profile icon
RixTheTyrunt

Hello, I need to convert a Python file ( Well, I will download Sprint's Pythonish file ) to a C++ one. How to do that? Also,
please,
HALP ME

You are viewing a single comment. View All
Profile icon
SixBeeps

That's kinda like asking "how can I make a dog out of a set of human bones?". Sure you might be able to do it, but it'd be a whole lot easier if you had a set of dog bones (i.e. just re-writing your program in C++).

What is your end goal?

Profile icon
RixTheTyrunt

OK, I will rewrite to C++.

Speech in C++


What about speaking?! Workaround this:

import pyttsx3 as sprintspeech engine = sprintspeech.init() rate = engine.setProperty("rate", 180) print("Current rate: " + rate) engine.say("Hi. I am PyAssis.") # Then I won't use Sprint instead of another fake one, I surely not make, or maybe I will ( <<:P) engine.runAndWait()
Profile icon
SixBeeps

@RixTheTyrunt
You'll have to learn how the system handles sound, likely stuff having to deal with audio streams or maybe even interpreting the hardware data.

Look for other libraries that might handle that for you.

Answer my question though, why do you want to do this? You might be able to avoid all of that if converting to C++ isn't your best option.

Profile icon
RixTheTyrunt

Well, I want to convert my Python code into an executable ( .EXE )

Profile icon
SixBeeps

@RixTheTyrunt
Then you do not need C++. Look into using PyInstaller instead.

Profile icon
RixTheTyrunt

I didn't install Python

Profile icon
RixTheTyrunt

At all.

Profile icon
RixTheTyrunt

Maybe Replit has a PyInstaller's package?

Profile icon
SixBeeps

@RixTheTyrunt
You should be able to run PyInstaller as you would on a local machine. Are you having issues with it?