简体   繁体   中英

Trying to download modules but python can't find them

So I need some modules for a project and after trying a lot of things and googling a lot of things I still can't get it to work. I used this code to test if the module was working:

import sys

sys.path.append('c:\\users\\my name\\anaconda2\\lib\\site-packages')

import numpy

x = randn(100,100)


And I got this error:


Traceback (most recent call last):

File "C:\\Users\\My Name\\Desktop\\test.py", line 3, in

import numpy

ImportError: No module named numpy


Any idea why I'm doing wrong?

You can try two things:

1) which python

And see what python you are using. You may be still pointing to old python the system has. In that case add ~/anaconda2/bin to $PATH environment variable.

2) sys.path.append('c:\users\my_name\anaconda2\lib\python2.x\site-packages')

Usually anaconda library is installed under lib\\pythonx.x(the correct python version number)\\site-packages. So change that.

If none of the above worked, then just do clean install from scratch all over again.

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