解决PyCharm下载PyInstaller报错You should consider upgrading via the 'python -m pip install --upgrade pip' command
可以按照如下步骤进行:
Step 1:在 PyCharm 中打开终端
首先,我们需要在 PyCharm 中打开终端,方法是依次点击菜单栏中的“View”->“Tools Windows”->“Terminal”。
Step 2:升级 pip
在终端中输入以下命令:
python -m pip install --upgrade pip
这样就会升级 pip。如果升级成功,则会显示以下内容:
Requirement already up-to-date: pip in /usr/local/lib/python3.9/site-packages (21.2.4)
Step 3:安装 PyInstaller
输入以下命令进行 PyInstaller 的安装:
pip install pyinstaller
如果安装成功,终端中会有类似以下的显示:
Successfully installed PyInstaller-4.4 pycryptodomex-3.10.1 typing-extensions-3.10.0.2
至此,PyCharm下载PyInstaller报错的问题就解决了。
示例说明1:
假设我们想要使用以下命令安装 PyInstaller:
pip install pyinstaller
但是终端返回如下错误:
DEPRECATION: Python 3.6 reached the end of its life on December 23rd, 2021. Please upgrade your Python as Python 3.6 is no longer maintained. pip 21.0 will drop support for Python 3.6 in January 2021. More details about Python 3.6 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-36-support
ERROR: Could not find a version that satisfies the requirement pyinstaller (from versions: none)
ERROR: No matching distribution found for pyinstaller
此时,我们可以采用上述的方法升级 pip 和安装 PyInstaller,具体操作方法请见上文。
示例说明2:
假设我们已经在终端中执行了以下命令:
pip install pyinstaller
但是终端返回如下错误:
ERROR: Could not build wheels for pycrypto which use PEP 517 and cannot be installed directly
这种情况下,我们可以采用以下命令尝试重新安装 PyCryptodome:
pip install pycryptodomex
安装完成后,再次执行以下命令即可:
pip install pyinstaller
此时,应该就能够成功安装 PyInstaller 了。