[Qt-creator] Python support in 4.9

Eike Ziller Eike.Ziller at qt.io
Wed Mar 27 19:09:23 CET 2019

> On Mar 1, 2019, at 21:46, Jason H <jhihn at gmx.com> wrote:
> I was just taking a look at the beta, and am sharing my findings.
> 1. it looks like there isn't a way to import an existing python project?
> 1a. With an existing project how do I configure a .pyproject file, including specify the file with main / QApplication / entry point?

I think there currently is no transitioning implemented.
If I understand that correctly the default entry point for a .pyproject is the first file in the “files” list.
(But you can create run configurations that start any of the python source files in the project.)

> 2. I also created and selected the default Qt for Python - Window project and hit run, and I got:
> 15:25:00: Starting /usr/bin/python /Users/jhihn/Projects/test_pythonwindow/main.py...
> Traceback (most recent call last):
>  File "/Users/jhihn/Projects/test_pythonwindow/main.py", line 3, in <module>
>    from PySide2.QtWidgets import QApplication, QMainWindow
> ImportError: No module named PySide2.QtWidgets
> 15:25:00: /usr/bin/python exited with code 1
> But if I run it from the command line it works: 
> python main.py   # works

I assume you are on macOS and I’d guess that this is related to the usual “environment in Terminal is different than environment in applications started from Finder/Dock/Spotlight”.
Does it work when opening Qt Creator from the Terminal with open <path_to>/Qt Creator.app ?
Or, which python executable are you actually using on the terminal, possibly from Brew? The default in the python run configuration in Qt Creator seems to be /usr/bin/python.

> 3. Starting QtCreator is slow. I get a beach ball and then a Secchi disk. Takes about 10 seconds.

Could you create a bugreport and attach a “Sample Process” from Activity Monitor?

> 4. Unfortunately all python projects will be called "main" in the project explorer.
> Maybe the entry point should be $1.py where $1 is the name of the directory? i.e. test_pythonwindow (see attached)

You mean when creating the project with the wizard?

I see that in the the “empty” wizard. That could be improved.
In the “window” wizard you can specify any name for the project name and main python file (default based on the main class name)

> 5. How do I specify python3 for a project? It seems to default to python 2?

You can specify the exact python interpreter to use in the run configuration. I don’t see a way to change the default (which seems to be /usr/bin/python).


Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list