0

I cannot install package in Python.For example the package numpy or pandas.I download the python today. I press import numpy as np and nothing

asked Oct 16, 2018 at 15:37
2
  • 1
    What happens? Do you receive an ImportError? Commented Oct 16, 2018 at 15:40
  • 1
    please share more info regarding the environment where you are trying to install python and what you have tried so far Commented Oct 16, 2018 at 15:43

3 Answers 3

1

You have to install it first. Search "Python Pip" on google and download Pip. Then use that to open CMD and type "pip install (Module)". Then it should import with no errors.

answered Oct 16, 2018 at 15:42
Sign up to request clarification or add additional context in comments.

Comments

1

first install pip (for example in ubuntu use either of the following)

$> sudo apt install python-pip #python 2
$> sudo apt install python3-pip #python 3

Now install the python package (for example numpy)

pip install numpy

This is the simplified version. Now if you need python for something like datas science then install anaconda ( which has libaries like numpy, pandas etc bundled together)

  1. go to anaconda website and download the anaconda version that you need
  2. Open terminal window and navigate to the download directory
  3. run the following command (use sh instead of bash depending on flavor of Linux). Assuming yours is a 64bit machine and you downloaded corresponding package then you would have downloaded the corresponding file:

    bash Anaconda-latest-Linux-x86_64.sh

  4. follow the instructions on the screen

quick documentation to Anaconda installation is here

answered Oct 16, 2018 at 15:50

Comments

0

If you are going to set up Python for Data Science or Machine Learning as you have mentioned about Numpy & Pandas, so it looks like you are going to set up Python for Data Science OR Machine Learning. The best and professional way is using the Anaconda.

Anaconda is a python and R distribution. It aims to provide everything you need for data science or Machine Learning "out of the box" for Python also.

It includes:

  • The core python language
  • 100+ python "packages" (libraries)
  • Spyder (IDE/editor - like pycharm) and Jupyter
  • conda, Anaconda's own package manager, used for updating Anaconda and packages

So, You can easily install it: You can easily download and install from here: https://www.anaconda.com/distribution/

If you are on Windows OS then you can follow this guide:

https://hackernoon.com/installing-python-and-anaconda-on-windows-f9059ba8b136

In case of Linux/Ubuntu go ahead here:

https://www.digitalocean.com/community/tutorials/how-to-install-anaconda-on-ubuntu-18-04-quickstart

And for MAC OS installation log on here:

https://conda.io/docs/user-guide/install/macos.html

answered Oct 16, 2018 at 15:52

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.