-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

0

1 Answer 1

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)])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.