python2 failed to install pyinstaller

important! ! !

On June 17, 2021, after stepping on the pit and querying stackOverFlow many times, I summarized the reasons for this part of the problem, and the reasons for the failure of python2 to install pyinstaller may be as follows:

  1. The version of pip does not match (probably you have upgraded pip before)
  2. Download the wrong pyinstaller (python2 is no longer supported after pyinstaller3.5)
  3. not run as administrator

Therefore: Please try the method in the fourth section (optimized version) of the catalog first! ! !

origin

Since the official does not support python2, many tools have gradually failed to keep up, directly using pip install pyinstaller will report an error.

process

I tried to use python -m pip install -U pip in the middle, and after updating pip, I found that it still didn't work, and I was very desperate.

After searching a lot of information, I found that pyinstaller no longer supports python2.7 after version 3.6, so I went directly to the official website to download the old package and install it manually.

Click on the following website
http://www.pyinstaller.org/downloads.html#The
latest version only supports python 3.5-3.9: Release 4.2: stable, supports Python 3.5–3.9

Click this link in the lower right corner, let's download the old version
Older (obsolete) releases can be found at the full list of releases .

insert image description here

It is obvious here that 4.0 no longer supports python2.7, and the last version supports 3.6

To be on the safe side, I downloaded 3.4
insert image description here

insert image description here
After the download is complete, extract it to this directory: C:\Python27\Lib\site-packages
(this is the address of your python pip installation tool)

Enter the folder, C:\Python27\Lib\site-packages\PyInstaller-3.4, open cmd and run

python setup.py install

There may be an error report, ignore it, and then reopen a cmd, execute

pip install --upgrade pyinstaller

run it again

再python setup.py install

At this time, success will be displayed

Re-open cmd and run

pyinstaller --version

show
insert image description here

Finally succeeded! ! !

Optimized version

  1. switch to admin

Windows is to run the terminal as an administrator, while Linux and Mac are to enter su and password to switch administrators

  1. Check the pip version and switch to the appropriate pip version

pip --version View the current version
pip install pip==18.1 If it is not 18.1, execute the code and switch to 18.1

  1. Download the version of pyinstaller that supports Python2

pip install pyinstaller==3.4

  1. Check if the installation was successful

pyinstaller -v

Hope you succeed too!

reference

Reference article for this article

https://blog.csdn.net/weixin_44164729/article/details/94609588

Precautions for using pyinstaller

Here are two good articles

Baiye Heiyu: http://www.python3.vip/tut/py/etc/toexe/
python Chinese community: https://mp.weixin.qq.com/s/tCMj4r2NT5TaaJ5pNtgllA

Guess you like

Origin blog.csdn.net/qq_37768971/article/details/117469932