美文网首页
Mac系统下python3 安装pyinstaller后 pyt

Mac系统下python3 安装pyinstaller后 pyt

作者: 丶Assassin丨 | 来源:发表于2021-11-16 15:56 被阅读0次

起因:

python3 安装pyinstaller后 python2 的pyinstaller不能使用

解答:

是因为在Mac系统中只能适用个pyinstaller 而python3 安装完 pyinstaller后 直接将原python2的pyinstaller在/usr/local/bin/目录中的程序替换,所以在执行python2 的pyinstaller时报错。

而由于pip的版本不适配的原因(很可能是在安装python3时升级了pip),python2的pyinstaller已不支持安装,,所以只能从其官网下载。

查询了很多资料之后,发现pyinstaller从3.6版本之后就不再支持python2.7了,因此直接去官网下载旧包手动install。

点击下面这个网站

http://www.pyinstaller.org/downloads.html#

最新版本写着只支持python 3.5-3.9: Release 4.2: stable, supports Python 3.5–3.9

点击右下角的这个链接,我们去下载旧版本

Older (obsolete) releases can be found at the full list of releases.

我下载的是3.6的版本,python2.7.10的就支持

下载完毕后,解压到python27/Lib/site-packages目录中,该目录是python pip安装插件时候所在的目录

进入目录,打开终端运行 python setup.py install

此时终端运行 pyinstaller --version

显示

3.6

如在安装pyinstaller时报错

pip install -upgrade pyinstaller

再运行 python setup.py install

而python3 安装 installer 则直接运行pip3 install pyinstaller 即可

Windows系统

1、切换到管理员

windows是以管理员身份运行终端,linux和Mac则是输入su和密码切换管理员

2、检查pip的版本,并切换到合适的pip版本

pip —version 查看当前pip版本

pip install pip==18.1 如果不是18.1则执行该命令,切换到18.1

3、下载支持python2的pyinstaller的版本

pip install pyinstaller==3.6

4、查看是否安装成功

pyinstaller -v

pyinstaller使用的注意事项:

在这里推荐两篇不错的文章

https://mp.weixin.qq.com/s/tCMj4r2NT5TaaJ5pNtgllA

http://www.byhy.net/tut/py/etc/toexe/

相关文章

网友评论

      本文标题:Mac系统下python3 安装pyinstaller后 pyt

      本文链接:https://www.haomeiwen.com/subject/xfmhtrtx.html