I am following the tutorial for py2exe from this site http://www.py2exe.org/index.cgi/Tutorial
this is the setup code:
from distutils.core import setup
import py2exe
setup(console=['script.py'])
when I type in cmd:
python setup.py install
I get this:
running install
running build
my script works fine and I even tried it for simple scripts such as
print "hello world"
I was able to use py2exe before without any problems but for some reason it stop working for me. I even tried to reinstall the module but it still won't do anything. Any idea's from those brilliant minds on stack overflow?
To build an exe, the command is:
python setup.py py2exe
Related
I am a beginner in python. I use windows 10 and IDLE. I have cloned a code from github and there are a bunch of *.py files. when I run the main code in python IDLE there is an error:
ModuleNotFoundError: No module named 'mayavi'
I tried to install mayavi in windows cmd using "pip", but again there is a long error starting with this sentence:
ERROR: Command errored out with exit status 1:
it seems that it is a bit complicated to install mayavi.
is this package installation thing a problem in IDLE? what if I use another IDE?
In fact I am not sure that IDLE is a good choice for coding python or not? In addition I am using python 3.10.1.
I look forward to hearing your advices.
Thanks in advance
Try AnaConda. It will manage the installation of python packages in an organized way.
The main probem was VTK installation. I tried the procedure explained here:
https://www.youtube.com/watch?v=IgvbhyDh8r0&t=222s
I have been trying for quite some time now to make my Python program run on pc's that don't have python installed. I have issues because I'm using python 3.6.0. In this post I am going to discuss a method I got from this video.
The first thing I did, was install Python 3.5 and create a virtualenv for it, which I activated. You can see how I did that on the post I made earlier today. After I activated the environment, I used this command in cmd in the python 3.5 environment: pip install cx_Freeze. It got installed with no errors. Then I made this setup.py file:
from cx_Freeze import setup, Executable
setup(name='vkv',
version='0.1',
description='Berekent de wortels van een vkv',
executables = [Executable('vkv.py')])
The python file that I want to turn into a .exe file is called vkv.py. The vkv.py file and the setup.py file are both the only 2 files on this path: C:\Users\hp\Desktop\Code\Python testing\distr.
Ok so now I only have to enter setup.py build in the command line in order to make the .exe file. But when I do that, I get a bunch of lines, with an error on the last line:
AttributeError: module 'dis' has no attribute '_unpack_opargs'
Here is a screenshot of it:
Does anyone know what I did wrong? Is it something in the setup.py file, is it not setting up the virtualenv correctly? And does anyone know what this error means and how I can fix it?
You are dealing with an version of cx_freeze that has a bug that manifests itself for versions larger than 3.5.2, this issue has already been reported here and fixed.
In short, a small change was introduced in Python 3.5.2 that cx_freeze failed to catch, now a check is made to work smoothly.
In short, you'll need to update cx_freeze, you could either try pip install -U cx_freeze or get the source for it.
p.s Using Python 3.6 right now probably isn't the best idea since quite some changes were made and bugs might take a while to be caught and fixed.
I've built an application in Python that I'd like to distribute to my enterprise and installing Python on each machine is unfortunately not an option. I'd like to convert the application to an .exe so that users can run my application with shortcut on their desktop.
This is my first attempt at distribution, so please forgive my lack of knowledge on the subject. I'm having issues with py2exe when I attempt to convert my .py script to a .exe.
My setup.py script looks like this:
from distutils.core import setup
import py2exe
import numpy
import matplotlib
setup(console=['inpho.py'],
data_files=matplotlib.get_py2exe_datafiles()
)
After I run python setup.py py2exe, I get the expected dist and build directories. However, if I run my application, now called InPho.exe, a cmd window opens and I immediately get an error: ImportError: No module named pkg_resources.
My first thought is that my setup.py script is wrong, I just do not know how to properly write one. In my inpho.py script, I use import the following:
pandas
Tkinter
pyodbc
sqlalchemy
sqlite3
datetime
tkMessageBox
os
shutil
Any help is greatly appreciated!
Py2exe might not handle some of the dependencies out of the box. Try this advice from the py2exe tutorial on how to handle import errors in this case: Dealing With ImportError
I had some similar issues with py2exe. I was able to fix them by downgrading setuptools to version 19.2.
You can see more information about this setuptools issue here: https://github.com/pyinstaller/pyinstaller/issues/1781
I am trying to create standalone exe of twisted application using PyInstaller. Everything is ok, even executable file is getting build, but its not working. I mean if try to execute it gives error 'Import error: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface."
I already have installed zope.interface 4.1.0. Also twisted application is running fine, with 'python ' But at the time of building executable file Pyinstaller is unble to import zope.interface.
How to solve this issue?
Thank you in advance.
finally problem solved.
Problem is zope.interface is not getting added in PYTHONPATH.
Actually I have tried different setups (like pip & exe), though it was not getting added. Exact reason I don't know.
But after installing zope.interface using 'easy_install ', it is added in PYTHONPATH & I am able to create executable file.
Thank you for taking interest.
Maybe it'll help in your problem: http://github.com/kpdyer/fteproxy/issues/66
I am trying to build a Python extension with Cython.
My OS is Windows7 64-bit, with Python2.7.5 32-bit, Cython 0.19.1, and Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1.
I tried to follow the instruction at this page to build a "Hello World" example.
I've wrote the "Hello World" Python script and "setup" file (actuall copy and paste) as the instruction told, and rename them properly.
Then I ran the setup.py as instructed:
python setup.py build_ext --inplace
There are no errors or warnings in the output. However, I cannot find the helloworld.dll in the folder.
Where was I wrong??
According to #martineau 's advice, I used sys.path.appendsys.path.append('<path_to_pyd_directory>') before I import my extension, and it works well.
The code I used is as follows:
import sys
sys.path.append("C:\Python27\Practice")
import helloworld
The output I have is:
Hello World
Many thanks to #martun again! :-)