PermissionError:[Errno 13] 权限被拒绝:pipenv 安装请求的“Pipfile”

2024-03-20

我正在尝试遵循有关 Pipenv 和 virtualenv 的指南:http://docs.python-guide.org/en/latest/dev/virtualenvs/ http://docs.python-guide.org/en/latest/dev/virtualenvs/。问题是,我在尝试时遇到了问题$ pipenv install requests(就我而言,我认为应该是$python3 -m pipenv install requests因为简单地pipenv返回未找到命令。)

为什么许可被拒绝?

我是一个终端新手,所以请耐心等待。

$ pip3 install --user pipenv

$ python3 -m pipenv

Usage: __main__.py [OPTIONS] COMMAND [ARGS]...

$ python3 -m pipenv install requests

Creating a Pipfile for this project...
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/__main__.py", line 4, in <module>
    cli()
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/cli.py", line 895, in install
    ensure_project(three=three, python=python)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/cli.py", line 180, in ensure_project
    ensure_pipfile(validate=validate)
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/cli.py", line 141, in ensure_pipfile
    project.create_pipfile()
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/project.py", line 219, in create_pipfile
    self.write_toml(data, 'Pipfile')
  File "/Users/sahandzarrinkoub/Library/Python/3.6/lib/python/site-packages/pipenv/project.py", line 226, in write_toml
    with open(path, 'w') as f:
PermissionError: [Errno 13] Permission denied: 'Pipfile'

确保您已添加UserBase https://docs.python.org/3/library/site.html#site.USER_BASE的 bin 目录添加到您的路径(按照注释框文档 http://docs.python-guide.org/en/latest/dev/virtualenvs#installing-pipenv您正在关注如何执行此操作)。

您提到的第三个命令应该是:pipenv install requests.


更长的版本:

由于您刚刚开始使用命令行(以及其他想要更深入参考的人),因此我将更深入地介绍一些命令行概念。

您显示三个命令:

  • pip3 install --user pipenv
  • 这样就完美了,可以安装了pipenv作为用户包(不适用于整个系统)
  • python3 -m pipenv
  • 这没有任何作用。你看到返回的是一个“使用留言 https://en.wikipedia.org/wiki/Usage_message“。它表示此命令需要一些 main.py 程序、选项(可选,因为在括号中)、命令(强制)和可能更多的参数。如果您看到用法消息,则意味着您没有按照其作者的意图调用该程序。
  • python3 -m pipenv install requests
  • 这应该只是pipenv install requests。但直到你将 UserBase 的 bin 添加到你的路径中(你会得到一个pipenv: command not found error).

Your PATH http://www.linfo.org/path_env_var.html您的 shell 将在其中搜索您列出的命令。请参阅更改您的路径Mac 或 Linux https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux/14638025#14638025 or Windows http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path.

As the 文档 http://docs.python-guide.org/en/latest/dev/virtualenvs#installing-pipenv您正在关注提及,您想要运行python3 -m site,您将得到类似以下内容的输出:

$ python -m site
  .
  .
  .
USER_BASE: '/Users/<myusername>/Library/Python/3.6' (exists)
USER_SITE: '/Users/<myusername>/Library/Python/3.6/lib/python/site-packages' (exists)
ENABLE_USER_SITE: True

现在您知道您的位置了USER_BASE是,添加一个/bin到最后并将其添加到您的路径中。再次参见操作系统特定说明,但在 OSX 上您可以添加export PATH="$PATH:/Users/<myusername>/Library/Python/3.6/bin给你的~/.profile, run source ~/.profile,当您输入命令时,您的 shell 现在将搜索该目录pipenv.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PermissionError:[Errno 13] 权限被拒绝:pipenv 安装请求的“Pipfile” 的相关文章

随机推荐

  • mysql concat_ws 没有重复项

    我试图将几个字段连接成一个字段 但只在结果字符串中保留唯一值 Example title orig title fr title de title it KANDAHAR KANDAHAR REISE NACH KANDAHAR VIAGG
  • Angular2:如何从node_modules导入样式表?

    问题 在我的 Angular2 4 0 应用程序中 如何从 node modules 中的模块导入样式表 css 我有一个模块位于此处 node modules swimlane ngx datatable 我想导入这个样式表 node m
  • iOS 使用 UIActivityViewController 将图像共享到 LinkedIn

    我正在尝试将图像共享给我的设备中安装的所有可能的应用程序 但不幸的是 我无法将图像成功发布到 LinkedIn 已安装并以经过验证的用户身份登录 LinkedIn 显示在 UIActivityViewController 中的共享操作列表中
  • Azure 存储 SAS 身份验证失败

    我有一个私有的 azure 存储容器 并且正在尝试 azure 存储 SAS 以便我可以上传和下载文件 我能够生成签名 但它总是向我抛出身份验证失败错误 AuthenticationFailed服务器无法验证请求 确保授权标头的值格式正确
  • python 类型提示不会为错误类型生成错误

    我最近正在检查类型提示 在阅读了一些理论后 我尝试了一个简单的示例 如下所示 def myfun num1 int num2 int gt int return str num1 num2 a myfun 1 abc print a out
  • 在 PHP 中输​​出带有换行符的文本文件

    我正在尝试打开一个文本文件并使用下面的代码输出其内容 该文本文件包含换行符 但当我回显该文件时 其未格式化 我该如何解决 Thanks fh fopen filename txt r pageText fread fh 25000 echo
  • 用双斜杠替换单斜杠,php

    如何用双斜杠替换单斜杠 我有这样的文字 data folder and i need get data folder 我尝试替换 但出现错误 data str replace data 你说的是反斜杠还是普通斜杠 无论如何 请检查下面的代码
  • Python 3 类型注释和子类

    如何在 Python 类型注释中引用 任何子类化父类的对象 例子 FooBase是一个抽象基类 其中Foo1 Foo2等被子类化 我希望该函数接受任何后代FooBase 这会吗 def do something self bar FooBa
  • 使用seaborn时如何从箱线图中获取统计值?

    我用seaborn制作了一个箱线图 我想获得一些统计值 例如最小值 第一四分位数 中位数 第三四分位数 最大值以及异常值 是否有任何函数或属性可以通过 seaborn boxplot 直接收集这些值 或者我应该通过其他包或手动计算这些 使用
  • 为什么我的本地对象被破坏了两次?

    我有一个返回本地对象的函数 class AT public AT cout lt lt construct lt
  • Birt 查看器无法加载报告查询

    当我尝试运行 BIRT 查看器时 显示以下错误 无法加载报表查询 163 为 ID 为 163 的报表元素生成报表文档时发生错误 元素 ID 163 但同一模块在 Eclipse 中成功地给出了报表设计结果 我正在使用 JDBC 连接 我该
  • 如何将JSON数据保存在本地(本机上)?

    我使用以下链接创建树状结构 这是我的代码
  • 删除零线二维numpy数组

    I run a qr factorization in numpy它返回一个列表ndarrays 即Qand R gt gt gt q r np linalg qr np array 1 0 0 0 1 1 1 1 1 reshape 3
  • 如何重定向到 CloudFront 分配中的特定 CNAME

    我在 AWS 中有 2 个 CloudFront 发行版 每个发行版都有自己不同的证书 每个 CNAME 都附加了多个 CNAME 并且每个 CNAME 在 Route 53 中都有一个对应的记录集 有没有办法将其中一个 URL 重定向到另
  • 在 C++ 中使用 setInterval()

    在JavaScript中 有一个函数叫做setInterval 用C 可以实现吗 如果使用循环 程序不会继续 而是继续调用该函数 while true Sleep 1000 func cout lt lt Never printed 没有内
  • For循环应该打印出ArrayList属性和其他ArrayList属性

    我正在尝试从同一系统中的两个不同的 ArrayList 打印属性 无法让它工作并自杀找出为什么它不起作用 for int i 0 i lt resultlist size i Athlete matched null Result res
  • 通过 Google Apps 脚本发布 Google 电子表格

    是否可以使用 Google Apps 脚本将 Google 电子表格发布到网络上 现在我必须使用手动执行此操作File gt Publish to the web 我检查了所有 Google Apps 脚本参考和指南 但没有看到任何有关通过
  • Java Swing 元素转换

    我正在尝试制作一个小型的非商业应用程序 并使其具有设计良好的界面 具有屏幕转换等功能 我在一个 JFrame 中的单独面板上拥有每个 屏幕 并且希望能够在面板之间转换时平滑地滑动它们 有什么办法可以轻松地实现这一点吗 由于您尚未接受答案 我
  • jQuery 中 $.map 和 $.grep 有什么区别

    有什么区别 map and grep在 jQuery 中 我想要一个尽可能简单的答案 我假设你的意思是 grep and map 不同之处在于我们使用 grep在我们使用时过滤数组 map将函数应用于数组中的每个项目 这是一个比我能做出的更
  • PermissionError:[Errno 13] 权限被拒绝:pipenv 安装请求的“Pipfile”

    我正在尝试遵循有关 Pipenv 和 virtualenv 的指南 http docs python guide org en latest dev virtualenvs http docs python guide org en lat