gpt4 book ai didi

python - 使用 Pip 安装 Flask

转载 作者:行者123 更新时间:2023-11-30 22:54:39 24 4
gpt4 key购买 nike

我是 Python 的新手,我正在尝试用它建立一个简单快速的后端。当尝试使用 Pip 安装 Flask 时,我运行它并看到以下错误:

Rutgers-MacBook-Pro:~ rutger$ pip install flask
Collecting flask
Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
100% |████████████████████████████████| 81kB 1.3MB/s
Collecting itsdangerous>=0.21 (from flask)
Downloading itsdangerous-0.24.tar.gz (46kB)
100% |████████████████████████████████| 51kB 3.4MB/s
Collecting click>=2.0 (from flask)
Downloading click-6.6.tar.gz (283kB)
100% |████████████████████████████████| 286kB 1.5MB/s
Collecting Werkzeug>=0.7 (from flask)
Downloading Werkzeug-0.11.10-py2.py3-none-any.whl (306kB)
100% |████████████████████████████████| 307kB 1.7MB/s
Collecting Jinja2>=2.4 (from flask)
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |████████████████████████████████| 266kB 2.7MB/s
Collecting MarkupSafe (from Jinja2>=2.4->flask)
Downloading MarkupSafe-0.23.tar.gz
Installing collected packages: itsdangerous, click, Werkzeug, MarkupSafe, Jinja2, flask
Running setup.py install for itsdangerous ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-l5geyj-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
copying itsdangerous.py -> build/lib
running install_lib
copying build/lib/itsdangerous.py -> /Library/Python/2.7/site-packages
error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous.py'

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-l5geyj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/

我还看到我有 2 个版本的 Python:

Rutgers-MacBook-Pro:~ rutger$ py
pydoc pydoc2.6 python python2 python2.6 python2.7 pythonw pythonw2.6
pydoc2 pydoc2.7 python-config python2-config python2.6-

运行 2.7:

Rutgers-MacBook-Pro:~ rutger$ python --version
Python 2.7.10

最佳答案

正如您在输出中看到的,错误是


错误:[Errno 13] 权限被拒绝:'/Library/Python/2.7/site-packages/itsdangerous.py'

您可以使用 sudo pip installflask 重试,它允许您以 root 用户身份运行原始命令。

关于python - 使用 Pip 安装 Flask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37693098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com