Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

python - pip vs conda in anaconda enviroment

I am using anaconda and I created a environment. when I run the model in spyder, it says no module named pandas. So I went back to the environment and tried to install pandas using pip install pandas. It says, requirement already satisfied, then I did: conda install pandas, then it has below information to install pandas. so now my question is, which one should I use, pip or conda when installing a package? I remembered installing tensorflow, I have to use pip instead of conda. then I opened spyder again and ran the code, there was still an error of no module named 'pandas' . Then I went back to environment cmd again, from ipython, I can find the version of pandas. I am confused, why spyder doesn't recognize pandas? anyone here help me clarify it? Thanks

The following packages will be UPDATED:

  ca-certificates                      2020.12.8-haa95532_0 --> 2021.1.19-haa95532_0
  pandas                               1.2.0-py38hf11a4ad_0 --> 1.2.1-py38hf11a4ad_0


Proceed ([y]/n)?


In [1]: import sys

In [2]: print(sys.version_info)
sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)

In [3]: import pandas

In [4]: print(pandas.__version__)
1.2.1

In [5]:

question from:https://stackoverflow.com/questions/65877275/pip-vs-conda-in-anaconda-enviroment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You probably have two different python interpreters on your system. Seems that your IDE/project is set up to use anaconda and your system terminal is defaulting to the one that came with your system.

You can use which python command on system terminal and also in IDE terminal to verify this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...