python newbie: importing numpy module in eclipse

前端 未结 3 598
面向向阳花
面向向阳花 2021-01-14 02:55

I\'m trying to run a simple python program in eclipse. This is the first time that I\'m importting any module.

So I downloaded: numpy and pylab (I\'m using a mac) re

相关标签:
3条回答
  • 2021-01-14 03:29

    If you are using PyDev, you should first have to go to Preferences, then Pydev, then Interpreter Python and then Libraries to add NumPy.

    Else, verify that you have NumPy installed, from the interpreter, just call from numpy import *

    Edit:

    Also check you already have Matplotlib installed, the error you are getting on the console points to that being the cause, you can download Matplotlib here.

    0 讨论(0)
  • 2021-01-14 03:30

    Simply removed the old numpy and installed version 6. located here

    Another way to circumvent this problem is to use pip install numpy check how to install pip

    0 讨论(0)
  • 2021-01-14 03:49

    I recently installed Anaconda3 and just started learning how to use Pandas and I wanted to be able to work with Pandas in Eclipse as well.

    I first tried adding a reference to the site-libraries at:

    C:\Anaconda3\Lib\site-packages
    

    And it seemed to work by allowing me to import numpy and pandas. However, since I had just used conda to update everything, my Python34 interpreter seemed to fail when I tried running some code and numpy was looking for my Python35 installation. For some reason this was located at:

    C:\Users\myname\AppData\Local\Programs\Python\Python35-32
    

    However, Anacondas installed another version somewhere else. By going into:

    Windows > Preferences > PyDev > Interpreters > Python Interpreter
    

    and clicking on Quick Auto-Config it found my Anacondas version of Python35 and then I just had to figure out how to make my current project use the Python35 interpreter.

    Hint: To do this, you need to go into the Project properties by opening the project and choosing File > Properties or right-click the project to choose Properties.

    0 讨论(0)
提交回复
热议问题