anaconda创建了虚拟python环境,且安装了pytorch,但是pycharm中import torch运行时报错

文章讲述了用户在使用Python虚拟环境时遇到numpy导入错误,原因是环境变量未包含conda配置的Python路径。解决方法是将环境变量添加conda环境的Libraryin路径,确保正确加载numpy库,避免了torch导入问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错如下:

C:\Users\tashi\.conda\envs\test1\python.exe D:\project\python\transformer\main.py 
C:\Users\tashi\.conda\envs\test1\lib\site-packages\numpy\__init__.py:127: 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 "C:\Users\tashi\.conda\envs\test1\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\tashi\.conda\envs\test1\lib\site-packages\numpy\core\multiarray.py", line 10, in <module&g

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值