venv 在 Wing Personal 9 IDE 中不工作。

huangapple go评论56阅读模式
英文:

venv not wokring in Wing Personal 9 IDE

问题

I'm trying to run this Python OpenVINO code snippet in Wing Personal 9 IDE for testing the installation.

from openvino.runtime import Core 

ie = Core()
devices = ie.available_devices
for device in devices:
    device_name = ie.get_property(device, "FULL_DEVICE_NAME")
    print(f"{device}: {device_name}")

It works in terminal from a virtual environment but no matter what I try in Wing, including starting a new project, I always seem to get builtins.AttributeError: partially initialized module 'openvino' has no attribute '__path__' (most likely due to a circular import) and builtins.ModuleNotFoundError: No module named 'openvino.runtime'; 'openvino' is not a package errors. Could someone tell how to make venv virtual environments work with Wing Personal 9? I have read the two pages from Wing website advicing on this but it just doesn't work.

英文:

I'm trying to run this Python OpenVINO code snippet in Wing Personal 9 IDE for testing the installation.

from openvino.runtime import Core 

ie = Core()
devices = ie.available_devices
for device in devices:
    device_name = ie.get_property(device, "FULL_DEVICE_NAME")
    print(f"{device}: {device_name}")

It works in terminal from a virtual environment but no matter what I try in Wing, including starting a new project, I always seem to get
builtins.AttributeError: partially initialized module 'openvino' has no attribute '__path__' (most likely due to a circular import) and
builtins.ModuleNotFoundError: No module named 'openvino.runtime'; 'openvino' is not a package errors. Could someone tell how to make venv virtual environments work with Wing Personal 9? I have read the two pages from Wing website advicing on this but it just doesn't work.

答案1

得分: 1

如果您正在使用virtualenv来设置Python环境,则不需要设置Python路径。相反,将Python可执行文件设置为已激活的环境,并输入激活环境的命令。

根据您遇到的错误,这是因为您正在运行一个Python脚本,其名称与OpenVINO包的名称冲突。

将您的Python脚本(openvino.py)重命名为除‘openvino’之外的任何名称。

英文:

If you are using virtualenv to set up your Python environment, you don't need to set Python Path. Instead, set Python Executable to Activated Env and enter the command that activates your environment.

Based on your encountered error, it is due to you are running a Python script which its name conflicts with the OpenVINO package name.

Rename your Python script (openvino.py) to any name except ‘openvino’.

huangapple
  • 本文由 发表于 2023年6月29日 22:43:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76582159.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定