Hello, I am new to Julia and just start to learn it this week. I got a problem to use PythonCall to call a Simple Python File Of WxPython Hello World. My Julia code and Python code are below. When I ran Julia code the below an error came out, I have searched online and tried many ways, but no luck. It looks like it can not find python.exe, but I am sure it is under the folder “C:\Python-3.12\python.exe”. is there a way to fix it? Thanks a lot! I appreciate it.
"
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.
ERROR: failed process: Process(python 'C:\JuliaTryOut\Test01.py', ProcessExited(9009)) [9009]
Stacktrace:
[1] pipeline_error
@ .\process.jl:597 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base .\process.jl:512
[3] run(::Cmd)
@ Base .\process.jl:509
[4] top-level scope
@ c:\JuliaTryOut\Test01.jl:18
"
-------------------My Julia Code---------------------------------------------------------
ENV[“JULIA_CONDAPKG_BACKEND”] = “Null”;
ENV[“JULIA_PYTHONCALL_EXE”] = “C:\Python-3.12\python.exe”
using PythonCall
pyimport(“sys”).path.append(pwd())
println(PythonCall.C.CTX.exe_path)
#pyexec(read(“Test01.py”, String));
run(python C:\\JuliaTryOut\\Test01.py)
-------------------My Python File Test01.py-------------------------------------------------------------
import wx
class MyFrame(wx.Frame):
def init(self):
# Initialize the parent class (wx.Frame)
super().init(parent=None, title=‘Hello World’, size=(300, 200))
# Add a panel to the frame for better layout management
panel = wx.Panel(self)
# Add static text to the panel
self.text = wx.StaticText(panel, label="Hello, wxPython!", pos=(100, 70))
if name == ‘main’:
# 1. Initialize the Application
app = wx.App()
# 2. Create and show the main frame
frame = MyFrame()
frame.Show()
# 3. Start the main event loop
app.MainLoop()