解决pyinstall打包python文件遇到的问题

1、环境说明

    Windows7,Anconda+Python3.5.2,64位系统。

2、开始安装

pip install pyinstall

安装成功,一切看起来很顺利,但实际上当你运行打包代码的时候,可能出现如下问题

pyinstaller -F test.py


AttributeError: 'str' object has no attribute 'items'

通过网上查找资料,很快就解决了,原来是setuptools没有安装。看到有篇文章里写到报错虽然是在最后一行,但问题却是在日志信息中,其中有No moudle named “setuptools._vender”这个提示。

pip install setuptools

安装完成后,我就可以打包简单的test.py文件了,文件内容即print(“hello world”)。这看起来,似乎没问题了。但是当我打包我的工程代码的时候,发现又开始报错。

pyinstaller -F test.py


from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object

网上看了一下,一般setuptools运行完就可以打包程序了,可能这是python3.5的bug?通过大神一顿操作分析,我得知问题在于日志信息中的cffi报错,于是安装了cffi

pip install --upgrade cffi

安装完成后,我们再次进行打包,这下就成功了。

猜你喜欢

转载自blog.csdn.net/dylan_me/article/details/92802866