1

I've installed Anaconda (with Python 3.5.2) and although while using IPython/PyCharm (after setting it to use Anaconda) I have access to all the packages, while using Python 3 through the terminal it refers to the python3.5.1 that comes with Ubuntu and it doesn't recognize any package.

I've set my path as explained here

echo $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/myname/anaconda3/bin

How to solve this?

7
  • Can you do echo $PATH and add its output to your question? – edwinksl Sep 24 '16 at 10:30
  • @edwinksl done that – proton Sep 24 '16 at 10:32
  • Where and how did you set your PATH? – edwinksl Sep 24 '16 at 10:37
  • @edwinksl see the link – proton Sep 24 '16 at 10:39
  • Put the path for Anaconda in front of everything else, i.e., do export PATH=/home/ofirarzi/anaconda3/bin:$PATH. Then do source ~/.profile and see if it works. – edwinksl Sep 24 '16 at 10:42
2

It looks like you were setting your PATH using

export PATH=$PATH:/home/ofirarzi/anaconda3/bin

Unfortunately, this means that /usr/bin/python3 comes first before //home/ofirarzi/anaconda3/bin/python3, so your system Python 3 gets called instead of Anaconda's Python 3 when you run python3 in the terminal. To fix this, you just need to reverse the order of the components of PATH, i.e., in your ~/.profile, do

export PATH=/home/ofirarzi/anaconda3/bin:$PATH

Then do source ~/.profile and try python3 again. For the new PATH to take effect in the terminal in the future without manually sourcing ~/.profile every time, you have to log out and then log in again or reboot.

Note that the way I have exported PATH is also described by Anaconda's documentation at https://docs.continuum.io/anaconda/install#linux-install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.