openai command not found (mac)

embedded/2024/10/19 9:31:57/
aidu_pl">

题意:mac 系统上无法识别 openai 的命令

问题背景:

I'm trying to follow the fine tuning guide for Openai here.

我正在尝试遵循 OpenAI 的微调指南

I ran:        我运行以下命令

python">pip install --upgrade openai

Which install without any errors.        正常安装,没有任何错误

But even after restarting my terminal, i still get

但是即使我重启了我的终端,我还是得到(某个错误或提示)

python">zsh: command not found: openai

Here is the output of echo $PATH:        以下是$PATH 命令的输出

python">/bin:/usr/bin:/usr/local/bin:/Users/nickrose/Downloads/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Here is the output of which python:           这里 which python 命令的输出

python">/usr/bin/python

Any tips for how to fix this? I'm on MacOS Big Sur 11.6.

关于如何解决这个问题,有什么建议吗?我现在使用的是 MacOS Big Sur 11.6。

问题解决:

Basically pip installs the packages under its related python directory, in a directory called site-packages (most likely, I'm not a python expert tbh). This is not included in the path you provided. First, ask pip to show the location to the package:

基本上,pip 将包安装在与其相关的 Python 目录下的名为 site-packages 的目录中(很可能是这样,但我不是 Python 专家,说实话)。这个目录没有包含在您提供的路径中。首先,让 pip 显示包的位置:

python">pip show openai

The output would be something like this:        输出将类似于这样:

python">Name: openai
Version: 0.22.0
Summary: Python client library for the OpenAI API
Home-page: https://github.com/openai/openai-python
Author: OpenAI
Author-email: support@openai.com
License: 
Location: /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages
Requires: numpy, openpyxl, pandas, pandas-stubs, requests, tqdm
Required-by:

So your package will be available in        所以您的包将可用在

python">/Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/openai

Either add /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/ to your path, or use the complete address to your package, or try to access it using your python:

“要么将 /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/ 添加到您的路径中,要么使用您的包的完整地址,或者尝试使用您的 Python 访问它”

python">python -m openai # -m stands for module

To get more information about the -m flag, run python --help.

要获取关于 -m 标志的更多信息,请运行 python --help

Update

So as you mentioned in the comments, you get permission denied after you add the directory to your package. This actually means that the package exists, but it's not permitted by your OS to execute. This is the thing you have to do, locate your package, and then:

正如您在评论中提到的,在将目录添加到您的包之后,您遇到了“权限被拒绝”的错误。这实际上意味着包是存在的,但是您的操作系统不允许执行它。这是您需要做的,找到您的包,然后:

python">sudo chmod +x /PATH/TO/script

And the reason you're getting command not found after you use sudo directly with the package, is that you update your path variable in zsh, but when you use sudo, superuser uses sh instead of zsh.

您在使用 sudo 直接与包一起时遇到 “command not found” 的原因,是因为您在 zsh 中更新了路径变量(PATH),但是当您使用 sudo 时,超级用户(superuser)默认使用 sh 而不是 zsh。这意味着 sudo 命令不会继承您当前 shell(在这个例子中是 zsh)的环境变量,包括 PATH 变量。


http://www.ppmy.cn/embedded/93374.html

相关文章

TeleVis:基于NLP的新冠新闻舆情可视化项目

关联比赛: 疫情数据可视化公益行动 一、项目名称 TeleVis&#xff1a;基于NLP的新冠新闻舆情可视化项目 二、团队信息 团队名称&#xff1a;TeleVis 单 位&#xff1a;金融壹账通大数据研究院 成 员&#xff1a;杨镭、郭凌峰、王天宇、黄北辰、齐婧含 三、项目介绍 政企机构的…

Qt自定义TreeWidget,实现展开折叠按钮在右侧,且一条竖直线上对齐

效果如下&#xff1a; 图片随便找的&#xff0c;可能需要调下样式&#xff0c;代码复制可用&#xff0c;留给有需要的人。 #ifndef CustomTreeWidget_h__ #define CustomTreeWidget_h__#include <QTreeWidget> #include <QPushButton>class CCustomTreeWidget : p…

超好用的windows系统工具PowerToys

文章目录 Github地址基本介绍使用 Github地址 PowerToys 基本介绍 是windows官方好用的工具箱&#xff0c;包括各种工具 使用 要带上win键 此工具安装后每次运行电脑自启动&#xff0c;桌面没有快捷方式&#xff0c;只能右下角 窗口在上效果演示&#xff0c;会被蓝线框到…

星戈瑞-二油酰磷脂酰乙醇胺标记荧光素 DOPE-FITC

DOPE-FITC&#xff0c;全称为1,2-dioleoyl-sn-glycero-3-phosphoethanolamine-N-FITC&#xff0c;是一种结合了二油酰磷脂酰乙醇胺&#xff08;DOPE&#xff09;与荧光素异硫氰酸酯&#xff08;FITC&#xff09;的复合标记物。以其独特的磷脂结构和强烈的绿色荧光特性&#xff…

怎么防止电脑上的重要视频被录屏

加密软件防录屏是通过一系列技术手段来防止视频内容在播放过程中被非法录制和传播。 一、视频加密技术 高强度加密算法&#xff1a;使用如AES256位等高强度加密算法对视频内容进行加密&#xff0c;确保视频在传输和存储过程中的安全性。这样&#xff0c;即使视频被录制&#…

rm命令学习

删除文件 rm rm命令&#xff08;remove的简写&#xff09;用来删除文件。这条命令会彻底地删除文件&#xff0c;文件将不复存在。Linux命令行可没有“垃圾箱”或“回收站”之类的东西。shell缺少一个恢复删除文件的命令&#xff0c;最好一开始就小心些。 如果你想确保绝对没有…

前端获取视频文件宽高信息和视频时长

安装 yarn add video-metadata-thumbnails | npm install video-metadata-thumbnails引入依赖包 import { getMetadata } from video-metadata-thumbnails使用 if (file.name.includes(mp4)) {if (file) {try {console.log(file)// 获取视频的元数据const metadata await …

使用 MongoDB 构建 AI:Flagler Health 的 AI 旅程如何彻底改变患者护理

Flagler Health 致力于为慢性病患者提供支持&#xff0c;为其匹配合适的医生以提供合适的护理。 通常&#xff0c;身患严重病痛的患者面临的选择有限&#xff0c;他们往往需要长期服用阿片类药物&#xff0c;或寻求成本高昂的侵入性外科手术干预。遗憾的是&#xff0c;后一种方…