cmd安装命令:
pip install pyinstaller
报错如下,根据提示执行
Using cached https://files.pythonhosted.org/packages/dc/d9/6d76544c4d554cdabc58e11a28b88a9767b1a57399c460342eff2ad0aeab/pyinstaller-5.8.0-py3-none-win_amd64.whl Collecting pefile>=2022.5.30; sys_platform == “win32” (from pyinstaller) Could not find a version that satisfies the requirement pefile>=2022.5.30; sys_platform == “win32” (from pyinstaller) (from versions: ) No matching distribution found for pefile>=2022.5.30; sys_platform == “win32” (from pyinstaller) You are using pip version 19.0.3, however version 23.0.1 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.
python -m pip install --upgrade pip
仍然报错
Downloading https://files.pythonhosted.org/packages/07/51/2c0959c5adf988c44d9e1e0d940f5b074516ecc87e96b1af25f59de9ba38/pip-23.0.1-py3-none-any.whl (2.1MB) 14% |████▌ | 296kB 18kB/s eta 0:01:38Exception: Traceback (most recent call last): File “C:\Users\87974\AppData\Local\Programs\Python\Python37\lib\site-packages\pip_vendor\urllib3\response.py”, line 360, in _error_catcher yield File “C:\Users\87974\AppData\Local\Programs\Python\Python37\lib\site-packages\pip_vendor\urllib3\response.py”, line 442, in read data = self._fp.read(amt) File “C:\Users\87974\AppData\Local\Programs\Python\Python37\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 62, in read data = self.__fp.read(amt) File “C:\Users\87974\AppData\Local\Programs\Python\Python37\lib\http\client.py”, line 457, in read n = self.readinto(b)
解决方法:
更新pip版本
方案一:执行命令
easy_install -U pip
方案二:若方案一失败,则可采用国内源下载更新。执行命令:
python -m pip install --upgrade pip -i https://pypi.douban.com/simple
再次执行
pip install pyinstaller
还是一直报错
然后更换安装方法:
# --执行还是慢,报错(建议不用这个)
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop
# --指定国内镜像---很快成功(建议使用这个方法)
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller