Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am trying to convert ui file created by QTDesigner to py file. but i get the error:
pyuic5 is not recognized as an internal or external command.
I use anaconda 3, and tried all suggestions here:
C:/Program is not recognized ...related to pyuic5
.
and i have seen here:
'Pyuic4' is not recognized as an internal external command
.
You need to first install pyqt5-tools
Via cmd writes
Notice
: python should be in windows environment variables :
pip install pyqt5-tools
Then you can use pyuic5
pyuic5 -x yourform.ui -o file.py
and add the "" to the batch
so it should be like this:
@"C:/Program Files/Anaconda3\python.exe" .....
then use this code to convert your file:
pyuic5 -x example.ui -o example.py
–
–
Create form by using Qtdesigner
Save the file as filename.ui in Anaconda3\Library\ bin location
Open command prompt
Make the path as C:\Users\SGU\anaconda3\Library\bin>
Then add the command to convert UI file to PY file as follows
C:\Users\SGU\anaconda3\Library\bin>pyuic5 –x filename.ui -o filename.py
Filename.py file created at location C:\Users\SGU\anaconda3\Library\bin>
Then Run the code by using Pycharm by opening the filename.py file to get the filename.ui file (Desined Window) will arrive at the output screen.
You should install PyQt5 first. As I was trying pyuic4 and it showed an error.
Then I saw that PyQt4 is not installed. So I tried pyuic5.
You can Install PyQt5 with the 'pip install pyqt5' command.
Here is my solution:
Before wasting my time on such an annoying problem I used the the linux subsystem ubuntu which I had installed before. There I simply tiped in:
pip install pyqt5-tools
copied the ui file to the current folder, typed
pyuic5 -x FILENAME.ui -o FILENAME.py
and copied the output file back.
If you have problems with showing linux directory, you should try to type in
\\wsl$
to file explorer in windows.
Sorry for my bad english. This is just a tip from my side which works kind of quick without reading the whole stackoverflow. :)
I could fix this problem by adding the path of Scripts
folder containing pyuic5.exe
to the System Environment Variables*.
For my case: C:\Users\My PC\AppData\Roaming\Python\Python311\Scripts
For me, moving the pyuic5 application from the path in which it was before to the path my file was.
Like before pyuic5 application was in the path:
C:\Users\ASUS\AppData\Roaming\Python\Python39\Scripts
And then I moved it to the path:
C:\Users\ASUS\Desktop\Jarvis-everything\Github Jarvis\Jarvis2\Code
Where my file was, then it worked.
For you, it might be different but it is easy to find.
Just open cmd
, type pip install pyqt5
then enter.
You will see that it shows "Requirement already satisfied"(if you have already installed) on the same line you will find your path where it is installed.
There, find the pyuic5 application and move it to the path where the file you want to convert is present.
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.