简体   繁体   English

ModuleNotFoundError:没有名为“azure.cognitiveservices.vision.customvision”的模块

[英]ModuleNotFoundError: No module named 'azure.cognitiveservices.vision.customvision'

I am trying to use the microsoft azure custom vision service on a mac from Jupyter in VS Code我正在尝试在 VS Code 的 Mac 上使用 Jupyter 的 microsoft azure 自定义视觉服务

I have Python 3.8.3 installed.我安装了 Python 3.8.3。

I have done pip install azure.cognitiveservices.vision.customvision and confirmed it is there using pip show.我已经完成 pip install azure.cognitiveservices.vision.customvision 并使用 pip show 确认它在那里。

When I execute the command from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient当我从 azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient 执行命令时

I get the error:我收到错误:

ModuleNotFoundError: No module named 'azure.cognitiveservices.vision.customvision' ModuleNotFoundError:没有名为“azure.cognitiveservices.vision.customvision”的模块

I have tried adding the location where the package is installed to $PATH but that does not fix the problem.我尝试将 package 的安装位置添加到 $PATH 但这并不能解决问题。

Any thoughts gratefully received!任何想法感激不尽! thx谢谢

It is recommended that you always create and activate a python virtual environment to work with Jupyter notebooks, like an Anaconda environment, or any other environment in which you've installed the Jupyter package.建议您始终创建并激活python 虚拟环境以使用 Jupyter 笔记本,例如 Anaconda 环境或您已安装 Jupyter ZEFE90A8E604A7C840E88D03A67ZF6B 的任何其他环境。

To select an environment, use the Python: Select Interpreter command from the Command Palette ( Ctrl+Shift+P ).要 select 环境,请使用命令面板中的Python:Select 解释器命令 ( Ctrl+Shift+P )。 Once the appropriate environment is activated, you can create and open a Jupyter Notebook and connect to a remote Jupyter server for running code cells.激活适当的环境后,您可以创建并打开 Jupyter Notebook 并连接到远程 Jupyter 服务器以运行代码单元。 Check Working with Jupyter Notebooks in Visual Studio Code for more info.查看在 Visual Studio Code 中使用 Jupyter Notebooks了解更多信息。

This is true for application development in Python in general as well. Python 中的应用程序开发也是如此。

A virtual environment is a folder within a project that isolates a copy of a specific Python interpreter.虚拟环境是项目中的一个文件夹,用于隔离特定 Python 解释器的副本。 Once you activate that environment (which Visual Studio Code does automatically), running pip install installs a library into that environment only.激活该环境后(Visual Studio Code 会自动执行该环境),运行pip install将库安装到该环境中。

When you then run your Python code, it runs in the environment's exact context with specific versions of every library.然后,当您运行 Python 代码时,它会在每个库的特定版本的环境的确切上下文中运行。 You can create a requirements.txt file for the libraries you need, then use pip install -r requirements.txt .您可以为您需要的库创建一个requirements.txt文件,然后使用pip install -r requirements.txt

Here is a snippet from a sample requirements.txt file:以下是来自示例 requirements.txt 文件的片段:

azure-mgmt-core==1.2.0
azure-mgmt-network==16.0.0
azure-mgmt-resource==10.2.0

If you don't use a virtual environment, then Python runs in its global environment that is shared by any number of projects.如果您不使用虚拟环境,则 Python 在其由任意数量的项目共享的全局环境中运行。

Refer to the Azure SDK for Python Developer docs for more information on configuring your local Python dev environment for Azure. Refer to the Azure SDK for Python Developer docs for more information on configuring your local Python dev environment for Azure.

Whenever U get: ModuleNotFoundError, the simple solution is to install the module using每当你得到:ModuleNotFoundError,简单的解决方案是使用安装模块

pip install (module name)

For example, in your case try to run the following line:例如,在您的情况下尝试运行以下行:

!pip install azure

The.这。 is to run a command in a notebook.是在笔记本中运行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError:没有名为“azure”的模块 - ModuleNotFoundError: No module named 'azure' ModuleNotFoundError:没有名为“sagemaker”的模块 - ModuleNotFoundError: No module named 'sagemaker' ModuleNotFoundError:没有名为“pystan”的模块 - ModuleNotFoundError: No module named 'pystan' ModuleNotFoundError:AWS Build 中没有命名的模块 - ModuleNotFoundError: No module named in AWS Build ModuleNotFoundError:没有名为“psycopg2”的模块 [AWS Glue] - ModuleNotFoundError: No module named 'psycopg2' [AWS Glue] ModuleNotFoundError:没有名为“google.cloud.location”的模块 - ModuleNotFoundError: No module named 'google.cloud.location' ModuleNotFoundError:没有名为“google.rpc.context”的模块 - ModuleNotFoundError: No module named 'google.rpc.context' firebase 和 python:ModuleNotFoundError:没有名为“urllib3”的模块 - firebase and python: ModuleNotFoundError: No module named 'urllib3' AWS Lambda - Python - ModuleNotFoundError:没有名为“pandas”的模块 - AWS Lambda - Python - ModuleNotFoundError: No module named 'pandas' ModuleNotFoundError:没有名为“application”的模块 [部署 Django 到 AWS] - ModuleNotFoundError: No module named 'application' [Deploying Django to AWS]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM