(d2l) D:\Py---my programmes\learn-python>d:/Machine-Learning/anaconda/python.exe "d:/Py---my programmes/learn-python/ai_big_model/trial.py"
Traceback (most recent call last):
File "d:\Py---my programmes\learn-python\ai_big_model\trial.py", line 1, in <module>
import openai
ModuleNotFoundError: No module named 'openai'
(d2l) D:\Py---my programmes\learn-python>openai
usage: openai [-h] [-v] [-b API_BASE] [-k API_KEY] [-p PROXY [PROXY ...]] [-o ORGANIZATION] [-t {openai,azure}] [--api-version API_VERSION]
[--azure-endpoint AZURE_ENDPOINT] [--azure-ad-token AZURE_AD_TOKEN] [-V]
{api,tools,migrate,grit} ...
positional arguments:
{api,tools,migrate,grit}
api Direct API calls
tools Client side tools for convenience
optional arguments:
-h, --help show this help message and exit
-v, --verbose Set verbosity.
-b API_BASE, --api-base API_BASE
What API base url to use.
-k API_KEY, --api-key API_KEY
What API key to use.
-p PROXY [PROXY ...], --proxy PROXY [PROXY ...]
What proxy to use.
-o ORGANIZATION, --organization ORGANIZATION
Which organization to run as (will use your default organization if not specified)
-t {openai,azure}, --api-type {openai,azure}
The backend API to call, must be `openai` or `azure`
--api-version API_VERSION
The Azure API version, e.g. 'https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-
versioning'
--azure-endpoint AZURE_ENDPOINT
The Azure endpoint, e.g. 'https://endpoint.openai.azure.com'
--azure-ad-token AZURE_AD_TOKEN
A token from Azure Active Directory, https://www.microsoft.com/en-us/security/business/identity-access/microsoft-
entra-id
-V, --version show program's version number and exit
(d2l) D:\Py---my programmes\learn-python>pip install openai
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: openai in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (1.11.1)
Requirement already satisfied: anyio<5,>=3.5.0 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (4.2.0)
Requirement already satisfied: distro<2,>=1.7.0 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (1.9.0)
Requirement already satisfied: httpx<1,>=0.23.0 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (0.26.0)
Requirement already satisfied: pydantic<3,>=1.9.0 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (2.6.0)
Requirement already satisfied: sniffio in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (1.3.0)
Requirement already satisfied: tqdm>4 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (4.66.1)
Requirement already satisfied: typing-extensions<5,>=4.7 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from openai) (4.9.0)
Requirement already satisfied: idna>=2.8 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from anyio<5,>=3.5.0->openai) (2.10)
Requirement already satisfied: exceptiongroup>=1.0.2 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from anyio<5,>=3.5.0->openai) (1.2.0)
Requirement already satisfied: certifi in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from httpx<1,>=0.23.0->openai) (2023.11.17)
Requirement already satisfied: httpcore==1.* in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from httpx<1,>=0.23.0->openai) (1.0.2)
Requirement already satisfied: h11<0.15,>=0.13 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)
Requirement already satisfied: annotated-types>=0.4.0 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from pydantic<3,>=1.9.0->openai) (0.6.0)
Requirement already satisfied: pydantic-core==2.16.1 in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from pydantic<3,>=1.9.0->openai) (2.16.1)
Requirement already satisfied: colorama in d:\machine-learning\anaconda\envs\d2l\lib\site-packages (from tqdm>4->openai) (0.4.6)
在环境中已经安装好了openai库,为什么调用失败呢?