簡體   English   中英

在 Python 中安裝 pyPDF2 時如何修復此錯誤

[英]How do I fix this error when installing pyPDF2 in Python

嘗試在命令提示符下使用以下文本安裝 pyPDF2 時收到以下錯誤:

python -m pip 安裝 pyPDF2

有什么建議可以解決嗎?

錯誤結果:

Microsoft Windows [版本 10.0.19042.572] (c) 2020 Microsoft Corporation。 版權所有。

C:\Users\bell_>python -m pip install pyPDF2
Collecting pyPDF2
  Using cached https://files.pythonhosted.org/packages/b4/01/68fcc0d43daf4c6bdbc6b33cc3f77bda531c86b174cac56ef0ffdb96faab/PyPDF2-1.26.0.tar.gz
Installing collected packages: pyPDF2
  Running setup.py install for pyPDF2 ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bell_\\AppData\\Local\\Temp\\pip-install-q3y1fs2o\\pyPDF2\\setup.py'"'"'; __file__='"'"'C:\\Users\\bell_\\AppData\\Local\\Temp\\pip-install-q3y1fs2o\\pyPDF2\\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\bell_\AppData\Local\Temp\pip-record-4uxjshye\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\bell_\AppData\Local\Temp\pip-install-q3y1fs2o\pyPDF2\
    Complete output (18 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\PyPDF2
    copying PyPDF2\filters.py -> build\lib\PyPDF2
    copying PyPDF2\generic.py -> build\lib\PyPDF2
    copying PyPDF2\merger.py -> build\lib\PyPDF2
    copying PyPDF2\pagerange.py -> build\lib\PyPDF2
    copying PyPDF2\pdf.py -> build\lib\PyPDF2
    copying PyPDF2\utils.py -> build\lib\PyPDF2
    copying PyPDF2\xmp.py -> build\lib\PyPDF2
    copying PyPDF2\_version.py -> build\lib\PyPDF2
    copying PyPDF2\__init__.py -> build\lib\PyPDF2
    running install_lib
    creating C:\Program Files\Python38\Lib\site-packages\PyPDF2
    error: could not create 'C:\Program Files\Python38\Lib\site-packages\PyPDF2': Access is denied
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bell_\\AppData\\Local\\Temp\\pip-install-q3y1fs2o\\pyPDF2\\setup.py'"'"'; __file__='"'"'C:\\Users\\bell_\\AppData\\Local\\Temp\\pip-install-q3y1fs2o\\pyPDF2\\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\bell_\AppData\Local\Temp\pip-record-4uxjshye\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

在您的錯誤中,它表示訪問被拒絕。 因此,在以管理員身份運行 cmd 時嘗試運行相同的命令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM