程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了VScode 中的 Conda 环境大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决VScode 中的 Conda 环境?

开发过程中遇到VScode 中的 Conda 环境的问题如何解决?下面主要结合日常开发的经验,给出你关于VScode 中的 Conda 环境的解决方法建议,希望对你解决VScode 中的 Conda 环境有所启发或帮助;

我创建了两个 Anaconda 环境,比如 A 和 B,以及基础环境。 我创建了环境 A 和 B,具体用于我对它们的处理(不同的库)。

现在我安装了 VScode。当我打开VScode并首先在下部设置正确的解释器(A或B)并运行一些特定于A和B的python程序时,该程序无法运行并出现错误。

D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package Failed to import,thereforE intel(R) MKL initialization ensuring its correct out-of-the Box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package,see http://github.com/Intelpython/mkl-service
  from . import _diStributor_init
TraceBACk (most recent call last):
  file "D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\core\__init__.py",line 22,in <module>
    from . import multiarray
  file "D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\core\multiarray.py",line 12,in <module>
    from . import overrIDes
  file "D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\core\overrIDes.py",line 7,in <module>
    from numpy.core._multiarray_umath import (
importError: DLL load Failed while imporTing _multiarray_umath: The specifIEd module Could not be found.

During handling of the above exception,another exception occurred:

TraceBACk (most recent call last):
  file "d:\Do\Python\ML practice\iris\own-knn.py",line 15,in <module>
    import numpy as np
  file "D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\__init__.py",line 140,in <module>
    from . import core
  file "D:\Anaconda\envs\practica-mldl\lib\site-packages\numpy\core\__init__.py",line 48,in <module>
    raise importError(msg)
importError: 

important: PLEASE READ THIS FOR ADVICE ON HOW TO SolVE THIS ISSUE!

imporTing the numpy C-extensions Failed. This error can happen for
installed.

We have compiled some common reasons and troubleshooTing tips at:

    https://numpy.org/devdocs/user/troubleshooTing-importerror.HTML

Please note and check the following:

  * The Python version is: python3.8 from "D:\Anaconda\envs\practica-mldl\python.exe"
  * The NumPy version is: "1.19.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further Help.

Original error was: DLL load Failed while imporTing _multiarray_umath: The specifIEd module Could not be found.

PS D:\Do\Python\ML practice\iris> conda activate practica-mldl

CommandNotFoundError: Your sHell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script,change your
invocation to 'CALL conda.bat activate'.

To initialize your sHell,run

    $ conda init <SHelL_name>

Currently supported sHells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powersHell

See 'conda init --Help' for more information and options.

important: You may need to close and restart your sHell after running 'conda init'.

但是当我通过 anaconda 提示打开 VScode 时,首先激活环境并通过键入 code 并运行一些程序打开 VScode,该程序会运行。

因此,据我了解,简单地更改 VScode 中的解释器与通过首先激活环境来打开 VScode 不同。我认为只需更改 VScode 中的解释器即可。

VScode 中是否有一个设置,我不必先激活环境来打开 VScode,这样我就可以运行特定于该环境的 Python 程序?

非常感谢!

编辑 1. 添加错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的VScode 中的 Conda 环境全部内容,希望文章能够帮你解决VScode 中的 Conda 环境所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:中的环境