我无法安装 Pyinstaller



当我尝试执行"pip install pyinstaller"我得到这个错误(Python 39)

ERROR: Command errored out with exit status 1:
command: 'c:python39python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\kaito\AppData\Local\Temp\pip-install-x1uajlp_\pefile\setup.py'"'"'; __file__='"'"'C:\Users\kaito\AppData\Local\Temp\pip-install-x1uajlp_\pefile\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UserskaitoAppDataLocalTemppip-record-i794i3gcinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:python39Includepefile'
cwd: C:UserskaitoAppDataLocalTemppip-install-x1uajlp_pefile
Complete output (14 lines):
running install
running build
running build_py
creating build
creating buildlib
copying pefile.py -> buildlib
copying peutils.py -> buildlib
creating buildlibordlookup
copying ordlookupoleaut32.py -> buildlibordlookup
copying ordlookupws2_32.py -> buildlibordlookup
copying ordlookup__init__.py -> buildlibordlookup
running install_lib
byte-compiling c:python39Libsite-packagespefile.py to pefile.cpython-39.pyc
error: [Errno 13] Permission denied: 'c:\python39\Lib\site-packages\__pycache__\pefile.cpython-39.pyc.2747580017328'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:python39python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\kaito\AppData\Local\Temp\pip-install-x1uajlp_\pefile\setup.py'"'"'; __file__='"'"'C:\Users\kaito\AppData\Local\Temp\pip-install-x1uajlp_\pefile\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UserskaitoAppDataLocalTemppip-record-i794i3gcinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:python39Includepefile' Check the logs for full command output.

我似乎无法解决这个问题,请帮助!

好吧,错误很明显,您没有访问您试图安装pip包的文件夹。

使用pip install --user pyinstaller

如果这不起作用:

创建一个虚拟环境并在其中安装包:

  1. 打开终端
  2. 使用命令cd进入你的项目文件夹
  3. 使用virtualenv venv
  4. 命令创建虚拟环境
  5. 使用venvScriptsactivate.bat
  6. 命令激活虚拟环境
  7. 激活虚拟环境后,您将拥有一个具有创建/编辑/删除文件权限的虚拟环境。所以,你可以用pip install pyinstaller
  8. 命令在那里安装这个包

您可能还想通过右键单击下面路径中的文件夹来检查文件权限。

c: python39 Lib 网站

也有一个相关的帖子,你可能想检查。它可以让你知道哪里出了问题。

您的错误是:

error: [Errno 13] Permission denied:

这可能是因为您不是计算机上的管理员用户。您可以切换到管理员帐户或以管理员身份运行终端/命令提示符(右键单击命令提示符选择"以管理员身份运行")

以管理员身份运行cmd。在UAC窗口中选择"是"。

最新更新