简体   繁体   中英

Miniconda “installs” numpy but Python can't import it

So I have been having some trouble with this. I need to use numpy so that I can use OpenCV and so I installed Miniconda (Not Miniconda3 because we are working in Python 2.7) and I installed numpy with conda install numpy and it worked because when I run conda list I see that it is there:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\joe30_000>conda list
# packages in environment at C:\Users\joe30_000\Miniconda:
#
conda                     3.17.0                   py27_0
conda-env                 2.4.2                    py27_0
menuinst                  1.0.4                    py27_0
numpy                     1.9.3                    py27_0
pip                       7.1.2                    py27_0
pycosat                   0.6.1                    py27_0
pycrypto                  2.6.1                    py27_3
python                    2.7.10                        0
pyyaml                    3.11                     py27_2
requests                  2.7.0                    py27_0
setuptools                18.3.2                   py27_0
wheel                     0.26.0                   py27_1

C:\Users\joe30_000>

And as you can see it is installed for Python 2.7. However, when I go to the python command line and try import numpy I get the error that no module exists:

Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>

Why is this happening? Do I have to somehow sync Conda with Python so that Python is using the modules that Miniconda has installed?

So thanks to @Bubbafat, I found the solution and I want to post it in case anyone else has problems. Like Bubbafat said, conda has its own version of the Python interpreter. It is located in the Miniconda directory (It's called "Python.exe"). If you are using an IDE you need to switch the interpreter to use this version of Python rather than the default one you may have installed on the internet from the Python website itself. I hope this was helpful.

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