简体   繁体   中英

How to use base Anaconda environment in PyCharm

My python program runs when I go to the terminal and type

activate base
python data_load.py

This is where python is located:

where python
C:\ProgramData\Anaconda3\python.exe

Then I try to use PyCharm with Anaconda and I go to Settings > Project Interpreter > Add Local > Conda Environment > Existing Environment and C:\\ProgramData\\Anaconda3\\python.exe as the interpreter. When I click the run button data_load.py does not run properly and there is a runtime error saying this:

Traceback (most recent call last):
  File "C:/Users/Anonymous/PycharmProjects/pytorchHelloWorld/data_load.py", 
line 4, in <module>
import pandas as pd
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", 
line 42, in <module>
from pandas.core.api import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\api.py", 
line 10, in <module>
from pandas.core.groupby.groupby import Grouper
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 66, in <module>
from pandas.core.generic import NDFrame, _shared_docs
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py", line 43, in <module>
from pandas.core.internals import BlockManager
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals.py", line 76, in <module>
from pandas.core.sparse.array import _maybe_to_sparse, SparseArray
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\sparse\array.py", line 33, in <module>
import pandas._libs.sparse as splib
  File "pandas\_libs\sparse.pyx", line 17, in init pandas._libs.sparse
AttributeError: module 'numpy' has no attribute 'version'

You need to create a PyCharm Enviornment.

Step 1: 在此处输入图片说明

Step 2: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM