-1

I am installing ipython in my windows machine.

I add the path C:\python34\scripts\ and ran this command

    pip install ipython

Once it is completed, ipython.exe is found in C:\python34\scripts\ and when i try this statement

    m = array([arange(2), arange(2)])

it returns NameError: name 'array' is not defined

Question 1. is C:\python34\scripts\ the correct directory to install to? 2. if yes, do i need to import library everything i run 3. if not, which directory should i install and how to install

NHK
  • 1
  • 1
  • 3

1 Answers1

1

Ipython is just an interactive command shell which somehow extends the normal Python shell to become more interactive and does not, generally speaking, include any additional Python modules or packages.

array and arange are part of the numpy package which needs to be installed additionally by executing

pip install numpy

However, working on Windows numpy requires Microsoft Visual C++ 2010 as explained in this answer.

So, first of all, you should make sure to have Microsoft Visual C++ 2010 installed and afterwards you should be able to install numpy using pip.

After numpy works as desired you need to import this module in order to use it as desired:

from numpy import array, arange
m = array([arange(2), arange(2)])

For a more general approach I would suggest the following:

import numpy as np
m = np.array([np.arange(2), np.arange(2)])
Community
  • 1
  • 1
albert
  • 8,027
  • 10
  • 48
  • 84