[英]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. 我已经尝试了很长时间,以使我的Python程序在未安装python的PC上运行。 I have issues because I'm using python 3.6.0.
我遇到了问题,因为我正在使用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. 我做的第一件事是安装Python 3.5并为其创建了virtualenv,并激活了它。 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
. 激活环境后,我在python 3.5环境的cmd中使用了以下命令:
pip install cx_Freeze
。 It got installed with no errors. 它安装正确无误。 Then I made this
setup.py
file: 然后我制作了这个
setup.py
文件:
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
. 我想将其转换为
.exe
文件的python文件称为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
. vkv.py
文件和setup.py
文件都是该路径上仅有的两个文件: 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. 好的,现在我只需要在命令行中输入
setup.py build
即可生成.exe
文件。 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? 它在
setup.py
文件中是否存在,是否未正确设置virtualenv? 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 . 您正在处理的
cx_freeze
版本存在一个错误,该错误会在大于3.5.2
版本中体现出来,此问题已在此处报告并解决 。
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. 简而言之,在
Python 3.5.2
中引入了一个小的更改,使cx_freeze
无法捕获,现在进行了检查以使其工作顺利。
In short, you'll need to update cx_freeze
, you could either try pip install -U cx_freeze
or get the source for it. 简而言之,您需要更新
cx_freeze
,您可以尝试pip install -U cx_freeze
或获取源代码。
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. ps现在使用Python 3.6可能不是最好的主意,因为进行了许多更改,并且可能需要一些时间才能发现和修复错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.