【发布时间】:2021-07-18 08:57:44
【问题描述】:
我有一个名为ml 的conda 环境,我已使用以下命令在powershell 中激活了此环境:
>> conda init powershell
>> conda activate ml
(ml) >>
当我使用jupyter notebook 命令打开笔记本时,它工作正常,并且我可以访问ml 环境中的模块:
import torch # No errors inside a jupyter notebook cell
但是当我尝试在 powershell 和 Python 提示符中测试我的模块时,它不起作用:
(ml) >> py
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
我是 conda 环境的新手。有没有办法在 windows powershell 的 Python 提示符下使用 conda 环境?
【问题讨论】:
标签: python powershell jupyter-notebook anaconda conda