2

Python command in my Conda environment is not detected as Conda Python interpreter. After I activate Conda environment and command Python, it is still calling my system python.

I found this issue cuz I installed all the packages I need for a project and when I run the code it couldn't find the module.

When I check

python --version
Python 3.6.4

Which should be python 3.7.3 in my Anaconda3

also when I check the location of python

which python
/usr/local/bin/python

this one is not under anaconda directory. I check that anaconda3 folder and there were python3 and python3.7.

/anaconda3/bin/python3.7
python3            python3.7          python3.7m
python3-config     python3.7-config   python3.7m-config

Is there any way to solve the problem? Thank you in advance.

JIST
  • 1,139
  • 2
  • 8
  • 30
Guu
  • 39
  • 1
  • 7
  • 1
    Do you know [how to configure your PATH variable](https://unix.stackexchange.com/a/26059/214420)? – Niayesh Isky Apr 21 '19 at 04:41
  • @NiayeshIsky in FAQ, they said "Install Anaconda or Miniconda normally. There is no need to set the PYTHONPATH environment variable." but should I export PYTHONPATH? – Guu Apr 21 '19 at 04:54
  • 1
    The PATH variable is different from the PYTHONPATH variable. You should learn about [what the PATH is and how to use it](https://opensource.com/article/17/6/set-path-linux). Once you understand that, you will know how to solve your problem. – Niayesh Isky Apr 21 '19 at 05:06
  • @NiayeshIsky If you are mentioning PATH for anaconda3, I already check it in my bash_profile and bashrc – Guu Apr 21 '19 at 05:23
  • When you run `echo $PATH`, you should see the path to your Anaconda distribution of Python earlier than `/usr/bin`. If it appears later, `/usr/bin/python` will still be used because it will be found first, since the PATH is obeyed in order. Also, I hope you actually read the article I linked, since you _must_ understand how to use the PATH if you're using a Unix-based OS. – Niayesh Isky Apr 21 '19 at 17:35
  • Solved: [this link](https://github.com/landlab/landlab/wiki/Correcting-Install-Paths) helped me a lot. In my case, I had a `.profile` file other than `.bashrc` and `.bash_profile`. – Guu Apr 21 '19 at 23:08

1 Answers1

-1

Solved: this link helped me a lot.

I've already added PATH to my bash files when I asked the question.

In my case, I had a .profile file other than .bashrc and .bash_profile.

Guu
  • 39
  • 1
  • 7