pytorch安装踩坑

出现问题:

pip install torch torchvision
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "C:\Users\lenovo\anaconda3\lib\io.py", line 54, in <module>
ImportError: cannot import name 'open_code' from 'io' (unknown location)

这是因为尽管已经使用conda activate激活了虚拟环境,虚拟环境的python.exe所依赖的库却是conda中base环境。

删除

后来又:

换源

自己配置全局镜像(推荐)或者直接在命令后加上

-i https://pypi.tuna.tsinghua.edu.cn/simple/

有了

猜你喜欢

转载自blog.csdn.net/weixin_51561130/article/details/129271001