Fix PyCharm import torch package failure issue

  • 2020-12-16 06:00:00
  • OfStack

Anaconda3-5.1.0-MacOSX-x86_64.pkg is installed with the pytorch package after download and installation.

You need to adjust your environment to the new python3.6 directory.

1. In Project Interpreter, select "Show All..." The menu


Show All...

2. Click "+" to add a new Interpreter


 choose   :  Add Local...

 choose   :  System Interpreter

3. Select es23EN3.6 file in Anaconda3 directory.


 address   :  /anaconda3/bin/python3.6

4. After confirmation, there will be a long process of Task, which should be in the process of Updating Python Interpreter.

5. Test code:


#!/usr/bin/python3
# -*- coding: UTF-8 -*-
 
# @Author: ****
# @Time: 2018/5/22  In the morning 10:33
# @File: pto.py
 
import torch
x=torch.Tensor(2,3)
print (x)

Related articles: