Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将OpenVino setupvars.sh添加到PyCharm项目中?_Pycharm_Openvino - Fatal编程技术网

如何将OpenVino setupvars.sh添加到PyCharm项目中?

如何将OpenVino setupvars.sh添加到PyCharm项目中?,pycharm,openvino,Pycharm,Openvino,我想将OpenVino setupvars.sh添加到PyCharm项目中 我正在使用OpenVino进行一个项目,为了现在使用OpenVino,我在.bashrc中使用了下面的bash脚本 source /opt/intel/openvino/bin/setupvars.sh 然而,我想在这个项目上使用PyCharm,这使项目变得更容易处理,因为它越来越大 如何在PyCharm项目中使用OpenVino。您可以通过指向PyCharm中正确的Python解释器来设置它。要获取当前工作的Pyt

我想将OpenVino setupvars.sh添加到PyCharm项目中

我正在使用OpenVino进行一个项目,为了现在使用OpenVino,我在.bashrc中使用了下面的bash脚本

source /opt/intel/openvino/bin/setupvars.sh

然而,我想在这个项目上使用PyCharm,这使项目变得更容易处理,因为它越来越大


如何在PyCharm项目中使用OpenVino。

您可以通过指向PyCharm中正确的Python解释器来设置它。要获取当前工作的Python环境,请在本地系统中键入以下代码行

蟒蛇

导入系统 >>>sys.executable 记下此Python路径并将其添加到文件->设置->Python解释器(在pycharm中)

希望这有帮助

在Windows 10上为我工作: 运行CMD,然后:

“\Program Files(x86)\IntelSWTools\openvino\bin\setupvars.bat”

“C:\Program Files\JetBrains\PyCharm社区版2019.2\bin\pycharm64.exe”


在macOS上也可以工作。不知道linux。

这里有一个Ubuntu的解决方案

在bashrc文件中添加setupvars.sh。 打开终端并写入

gedit ~/.bashrc
将这些行添加到文件末尾

# <<< Initialize Intel Vino environment variables <<<
source /opt/intel/openvino/bin/setupvars.sh
# <<< Initialize Intel Vino environment variables <<<
通过执行从终端打开pycharm

pycharm-community

我想我们遇到了同样的问题

这是我的解决办法。希望能帮到你:)

制作自己的解释器文件
  • 创建一个新文件,例如python自定义文件

     touch python-custom
    
  • 打开你刚创建的文件

     vim python-custom
    
  • 将以下代码保存到文件中

     #!/bin/bash
    
     args=$@
    
     # needed environment path
     . /opt/intel/openvino/bin/setupvars.sh
    
     # Path of your normal python path
     # You can find it by "which python", "which python3" or any python you used
     /usr/bin/python3 $args
    
  • 为其添加可执行权限

     chmod +x python-custom
    
  • 在Pycharm中添加一个新的解释器

    文件--设置--项目解释器

  • 选择解释器时,请使用“/path/to/python custom”而不是“/usr/bin/python3”


  • 我尝试过这个,但是,我无法在PyCharm项目中导入openvino。现在,我使用PyCharm进行开发,但我使用terminal运行源代码?我身上没有Mac@user1315621这是一个错误。该路径用于我的项目。把它取下来试试。(我已经重新编辑了它)这个shell将使用包含您的环境的shell运行python代码,例如setupvars.sh,而不是普通的“/usr/bin/python”
     #!/bin/bash
    
     args=$@
    
     # needed environment path
     . /opt/intel/openvino/bin/setupvars.sh
    
     # Path of your normal python path
     # You can find it by "which python", "which python3" or any python you used
     /usr/bin/python3 $args
    
     chmod +x python-custom