Python numpy error
In Python, when I try...
Code:
>>> import numpy as np Code:
chris@chris-crunch:~/apps/caffe-master$ sudo apt install python-numpy |
I think I made it worse...
Code:
chris@chris-crunch:~/anaconda2/lib/python2.7/site-packages$ rm -rf numpy Code:
>>> import numpy as np Python 2.7.11 :: Anaconda 2.4.1 (64-bit) |
Hey,
Try to reinstall python [sudo apt-get remove/uninstall] and then [sudo apt-get install] ..). You can see if the system can find the library by calling [python --version], or [which python] in the CLI. What did you do to make it worse? You can confirm if your path is set right by doing [echo $PATH] in the CLI. Cheers! |
I wonder if you installed the correct version for the python interpreter you are trying to use?
On my system I have the following options: Code:
$ pacman -Ss python2?-numpy So you might have to confirm either which version you have installed or which version of the python interpreter you are using to run your script? |
I think I worked out the problem.
I was using anaconda2 as my version of python. This seems like a better idea to me, as if I'm messing around using commands like Code:
conda install bleh And it did break actually. My mentor was looking at it today. He said "something ate conda" as the conda command didn't exist anymore. lol. Okay so I'm trying to uninstall and reinstall Anaconda following the instructions on their website. Once I uninstalled it, the normal version of python was able to import numpy. So let's try with conda... Okay guys conda is installed again. But I'm still using the default python. Does anyone know how I can change this so it uses the conda version? something like pythonpath variable? |
As in, I think it's here:
Code:
/home/chris/anaconda2/lib/python2.7 Code:
chris@chris-crunch:~$ python EDIT: Okay, I think I've fixed it. By doing this Code:
conda create -n py27 python=2.7 anaconda I don't understand this: Code:
# To activate this environment, use: Code:
chris@chris-crunch:~$ python |
When you type "python", you basically tell your OS to look for the "python" program in the folders pointed to by your PATH - variable.
(I'm not experienced enough to give a more exact description) Same as you use "grep", "ls", "man", etc. These are all binaries that exist in your /etc/bin folder for example. So if you use "which python", you will get a directory of the python program that will be called if you type "python". Confirm first that Code:
/home/chris/anaconda2/lib/python2.7 |
You have mentioned a mentor, which would lead me to guess you are taking a course ... is there any reason you have not asked your teacher or mentor these questions?
In future you may want to alter your questions to advise that you are using anaconda instead of standard python otherwise you will receive answers (like my first one) that are irrelevant. |
Quote:
Yeah sorry about that. At the time I didn't even realize what anaconda was. Infact I still don't really. It seems like much more than a python distribution. Nevertheless tanks for your help. I would love to understand the theory more behind what is going on here, so I will continue to crawl through pages on google. (I'm a bit thick with this stuff). I know you have more important things to do that to teach everything to a newbie :p but if you could point me in the right direction to sources you think are good, I'm all ears. Chris. |
Not at all an issue being a noobie (still there myself for many things:) ).
Just pointing out that asking for help for a particular thing (like python) but really meaning something else (like anaconda) makes it tough for those who do know about one or the other to help you :) On a side note, is there a reason you went with anaconda instead of learning python first? ( I only ask as it seems a little strange to go after something not main stream if only in the learning phase ) Anyhoo, hope you get there :D |
All times are GMT -5. The time now is 08:24 PM. |