我无法安装Pyinstaller

2024-10-01 00:28:47 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试执行“pip安装pyinstaller”时,我得到了这个错误(python39)

    ERROR: Command errored out with exit status 1:
     command: 'c:\python39\python.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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\kaito\AppData\Local\Temp\pip-record-i794i3gc\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\pefile'
         cwd: C:\Users\kaito\AppData\Local\Temp\pip-install-x1uajlp_\pefile\
    Complete output (14 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib
    copying pefile.py -> build\lib
    copying peutils.py -> build\lib
    creating build\lib\ordlookup
    copying ordlookup\oleaut32.py -> build\lib\ordlookup
    copying ordlookup\ws2_32.py -> build\lib\ordlookup
    copying ordlookup\__init__.py -> build\lib\ordlookup
    running install_lib
    byte-compiling c:\python39\Lib\site-packages\pefile.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:\python39\python.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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\kaito\AppData\Local\Temp\pip-record-i794i3gc\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\pefile' Check the logs for full command output.

我似乎无法解决此问题,请帮助


Tags: installpippybuildliblocalrecordusers
3条回答

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

您的错误是:

error: [Errno 13] Permission denied:

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

好的,错误很明显,您无权访问您试图安装pip包的文件夹

使用命令pip install user pyinstaller

如果这不起作用:

创建virtualenv并在其中安装软件包:

  1. 打开一个终端
  2. 使用命令cd转到项目文件夹
  3. 使用命令virtualenv venv创建虚拟环境
  4. 使用命令\venv\Scripts\activate.bat激活虚拟环境
  5. 激活虚拟环境后,您将拥有一个虚拟环境,您有权创建/编辑/删除文件。因此,您可以使用命令pip install pyinstaller将包安装在那里

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

c:\python39\Lib\site-packages\

还有一个related post您可能需要检查。它可以让你知道什么是错的

相关问题 更多 >