简体   繁体   中英

cx_freeze AttributeError: module 'dis' has no attribute '_unpack_opargs'

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.

ps 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM