In my command shell (cmd) I try to convert an .ui file to a .py file via
pyuic4 C:\Test\gui.ui > C:\Test\gui.py
But it says:
The command C:\Python27\python is either typed wrong or could not been found
I am using the Anaconda distribution which is placed under AppData/Local/Continuum/Anaconda and there is a python.exe.
Changing the directory does not work.
How can I compile my .ui-file?
Use OSGeo4W shell instead of cmd, it can easily convert the .ui file to .py
Run the following command in OSGeo4W shell:
C:\path\to\my\ui\files\>pyuic4 -o ui_form.py form.ui
Hope this helps!
Related
On Windows, I can convert my python code to exe file using pyinstaller. And by running the resulting exe file, I can get the same output as in the normal code. In order to do the same on Ubuntu, I created the file with pyinstaller on Ubuntu again. But I couldn't find how to run this resulting file. Can you help with this?
For example:
After using pyinstaller on Windows, the file was created as:
example.py → example.exe
After using pyinstaller on Ubuntu, the file was created as:
example.py → example
But here I could not run the example file in any way.
In your terminal cd into the directory containing the executable. It should be in a dist/ folder.
Then run ./example If that doesn't work it just means that the execution bit isn't set on the file.
chmod +x ./example
./example
I was trying to convert my main.py to a exe file
I followed a tutorial on youtube i did it like it said
first open cmd in the folder
then type in pip install pyinstaller
then type in like this pyinstaller --onefile main.py
but it does'nt convert it shows this
While Eyal's solution is correct, there is an easier option. Just run this:
py -m PyInstaller --onefile main.py
It could also be python -m PyInstaller --onefile main.py depending on your system configuration.
This issue is probably caused because pyinstaller is not in the PATH environment variable.
First, find the full path of pyinstaller.exe - it should be in the Scripts directory of your Python installation (probably C:\Users\[USERNAME]\AppData\Local\Programs\Python\[Python_VER]\Scripts). Copy the full path.
Then open a command prompt (as Administrator) and run the command:
setx PATH "%PATH%;PYINSTALLER_PATH"
where PYINSTALLER_PATH is the full path of pyinstaller you have copied.
Then re-launch command prompt and run the command again.
I need to transform an .ui archive to a .py but I can't use the command pyuic4, it said command not found in the terminal.
I already try installing pyside, pyqt, use uic.py but nothing seems to work.
So, I finally solved it. I used pyuic5 -x Data.ui -o Data_ui.py in the terminal, but first I opened the folder where the executable pyuic5 was, paste Data.ui and then use the line pyuic5 -x Data.ui -o Data_ui .py. Remember to open the location of the executable in the terminal before using the command
I am trying out pyinstaller for the first time. I created a file named hello.py with just one line of code:
print "hello"
I used the following command to make a binary:
pyinstaller hello.py
The process completed successfully and a binary was created at dist/hello. I am not able to run this binary file. When I tried to run it from the terminal, I got,
bash: .: hello: cannot execute binary file
I tried to double click it from nautilus but nothing is happening.
How can I run this binary file?
I am using Ubuntu 16.04
Got it running by typing the relative path dist/hello in terminal
for linux (tested on ubuntu 16.04 python3)
pyinstaller hello.py --onefile it create one file named hello.
Then go inside dist folder use terminal
cd dist.
Then
./hello.
Looks not as windows way , but work. ./hello is something like , run outside...
I'd like to run python script under windows from command line
this is something like:
script_name.py C:\file\path
but it says SyntaxError: invalid syntax
and highlight 'C' symbol
this script is in C:\Python27\ folder
the code of script downloaded from here https://github.com/faucamp/bootstrap_namespace_prefixer
You need to type that into the Windows command prompt, not the Python shell.
And you shouldn't put your own code into the Python27 folder.
you can change directory from command prompt to C:\Python27\ then run python C:\Python27\folder\scriptname.py (path to script)
OR
Set environment variable then change directory to C:\Python27\folder. run python scriptname.py