首页 > 解决方案 > 安装 pip install 'python-decouple' 时出错

问题描述

Collecting python-decouple
  Using cached python-decouple-3.3.tar.gz (10 kB)
Using legacy setup.py install for python-decouple, since package 'wheel' is not installed.
Installing collected packages: python-decouple
    Running setup.py install for python-decouple ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"'; __file__='"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\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\slms_\AppData\Local\Temp\pip-record-aljfw6bc\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\python-decouple'      
         cwd: C:\Users\slms_\AppData\Local\Temp\pip-install-awe0dvrf\python-decouple\
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib
    copying decouple.py -> build\lib
    running egg_info
    writing python_decouple.egg-info\PKG-INFO
    writing dependency_links to python_decouple.egg-info\dependency_links.txt
    writing top-level names to python_decouple.egg-info\top_level.txt
    reading manifest file 'python_decouple.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'python_decouple.egg-info\SOURCES.txt'
    running install_lib
    byte-compiling c:\python38\Lib\site-packages\decouple.py to decouple.cpython-38.pyc
    error: [Errno 13] Permission denied: 'c:\\python38\\Lib\\site-packages\\__pycache__\\decouple.cpython-38.pyc.2802584858032'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"'; __file__='"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\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\slms_\AppData\Local\Temp\pip-record-aljfw6bc\install-rec

标签: python-3.xdjangowindowsherokuweb-deployment

解决方案


您显然缺乏进行安装的权限,您可以使用venv或以管理员身份运行 cmd(idk 我不使用 Windows)

要设置 venv,请在启动 cmd 时在项目目录中运行以下命令

C:\> python3 -m venv ./.venv 

然后运行你的安装脚本


推荐阅读