This question already has answers here:
How to install NumPy for python 3.3.5 on Mac OSX 10.9
(3 answers)
Closed 6 years ago.
I'm trying to install Numpy on my mac so i can practice doing some programming for data science. However i have no idea what i'm doing when it comes to downloading software and btw my knowledge of software instillation in general is terrible (i'm more of a pure mathematician). If it isn't as simple as hit download and it works (as it seemed to do with windows) i'm finding myself getting stuck.
I have python 3.5.1 downloaded on my mac. So the book i'm going through at the moment when talking about arrays starts by saying >>>import numpy, in the command prompt. Thinking it would just be as easy as that i tried it, but obviously it wasn't that simple because i haven't downloaded it. Anyway then i looked into downloading numpy, i downloaded a folder in my downloads called numpy.1.11.0 and copied and pasted it into my desktop. I went back to the idle and typed >>>import numpy again, and again it didn't work.
I'm so confused as to what to do now, i've looked at some older posts but they haven't helped, i've also downloaded an open source package called anaconda (something mentioned in the other posts) which i think has everything (data science related) on it but i have no idea how to use it. Do i create python scripts in anaconda? Do i create the scripts before and some how run them in anaconda?
I'd really appreciate any help regarding how to get numpy installed or perhaps how to start using python in anaconda (or both). I've found myself getting lost in all the jargon in the other posts, a simple step by step approach i.e "first click this", "then install this" would probably be best suited to me, if anyone knows where i can find instructions in this form i'd very much appreciate it.
Thanks for the help!
Edit: Thanks to everyone for the help it has been great, in particular i tried pip3 install numpy in the command line. Now i can import numpy in the python idle. If i want to use it in a script file (i'm using text wrangler for this) would i just import numpy as usual?
In addition i started playing around with anaconda and using the spyder package this also let's me run python scripts and allows me to import numpy.
Go to your terminal and run the following command:
pip3 install numpy
If that gives you permission or IO errors try using sudo
sudo pip3 install numpy
Related
I am trying to install OpenCV following this link https://docs.opencv.org/master/d5/de5/tutorial_py_setup_in_windows.html
opencv-4.5.1 is the version I am building from source. I have no errors in my entire process( up to Step 16)
Step 17 which INSTALL also has no errors, but Step 18 'import cv2 as cv' will not import this module.
I have python 3.9.1. I followed all the steps with CMAKE and was able to generate with no errors.
Is there something that I am missing here?
I would recommend to use another IDE like Pycharm to create your projects. It is extremely easy to setup an OpenCV work environment :).
IDLE is great for smaller projects but I`ve seen a lot of people having issues with it.
I've tried several fixes for this suggested in other threads, but no luck.
I'm new to Python. I had 3.8.5 installed and wrote a few simple scripts that worked using PyCharm and the numpy and sympy modules. Today I opened PyCharm and tried to write a simple script using numpy, but I got an error saying the numpy module did not exist. I also got this error when trying to run the older scripts. I checked in cmd with pip3, and got the result that it was already satisfied. I uninstalled Python, numpy, and PyCharm, reinstalled all and I'm having the same problem. This problem seemed to crop up on its own - I don't recall making any changes that would've caused this.
Can anyone give me other options?
One of the most common issues with Python is having multiple versions installed and losing track of which one you are using and/or which one you're installing to with pip.
In Pycharm check what interpreter your project is using. If there is more than one available chance are you installed numpy on the other one.
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add-existing-interpreter
You can also install numpy direct from Pycharm, simply hover over the import statement and if it's not installed on the current interpreter it will offer you a link to click in install it.
If that doesn't help, post the exact error message and your code.
This question already has answers here:
'pip' is not recognized as an internal or external command
(40 answers)
Closed 2 years ago.
I am a new python user. I downloaded python and VS code and ran a few scripts such as print statements and for loops, and everything seems to be working alright.
However, I want to be able to use packages such as numpy. The way that I understand it, I am supposed to go to my computer's command line and type something in such as "pip install numpy," to get numpy installed. However, I have tried typing in many variations of this phrase into my command line, such as "pip3 install numpy", "python install numpy", and things of this nature. No matter what I type in, I get the message "_____ is not recognized as an internal or external command, operable program or batch file."
I am having trouble even getting my command line to recognize that I have python set up and downloaded... and yet, I can clearly access python in VS code as well as on my computer in general. One possible problem is maybe I am in the wrong directory? But I do not know how to find this out of change to the correct directory. Can someone please tell me what to type in or what I am doing wrong? I am on a windows 64 bit computer.
Thank you so much! :)
There is two step for installing python in windows. If you want to user python in your command line, you have to set a PATH. These can help you:
1- https://geek-university.com/python/add-python-to-the-windows-path/
2- How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
After set PATh, you can use python in your command line. Then you should install pip tool. This link gives you a hand to do that:
1- https://phoenixnap.com/kb/install-pip-windows
After installing python and pip, i recommend you to google about virtualenv. It's a wide used tool for python programming.
Normally you dont need to install numpy. Just use in your code:
import numpy as np
Run the script. If you dont see any errors it is because you already had it.
First off I would like to say that I am aware that this question has been asked before, however, none of the other posts have offered a solution that resolves the problem.
I am trying to use pandas-datareader to grab stock prices from the internet. I am using windows with python version 3.6. I first installed pandas-datareader from the console using
pip install pandas-datareader.
I then wrote a code which used the line
import pandas_datareader.data as web
It came back with the error
`ModuleNotFoundError: No module named 'pandas_datareader'
I tried to redownload pandas-datareader, just in case it didn't work the first time, but the console came back with "Requirement already satisfied" so that wasn't the problem.
From there I uninstalled pandas-datareader, and reinstalled it with
pip3 install pandas-datareader
I still got the same error message.
I was worried that it might have something to do with old versions of python installed on my computer so I deleted all files for python 2.7, but this did not help the issue. I restarted spyder and my computer and this did not help. I tried Jupiter notebook and this did not help either.
Now to take my investigation one step further, I looked in my file folders at the hidden files to see where pandas-datareader could be hiding. When I go to C:\Users\J.Shepard\Anaconda3\pkgs and C:\Users\J.Shepard\Anaconda3\pkgs I see that pandas-0.23.0-py36h830ac7b_0 is installed but I cannot find anything that looks like pandas-datareader. In fact, when I search for "pandas-datareader" in my file search, I only see 2 text files with one line of code each. I do not know what to make of this discovery but I thought it might be helpful to someone else.
I hope that I have made a good case to prove that I have genuinely tried and failed to solve this problem on my own. Based on the number of other unresolved posts related to this same question, I believe that this is a question that deserves to be asked again.
I tried conda install pandas-datareader in Anaconda Prompt. It was installed and after my computer restarted, pandas-datareader worked in spyder 3.6.
I am trying to start the newcoder.io data vizualization tutorial but am having a difficult time installing numpy on Windows (8.1, python 2.7).
When I go to install it using pip the process never completes, even if I leave it for an hour or more. It doesn't give me any errors or anything either so I don't know how to track down what is causing this.
Here is what is looks like:
(datavizproj)PS C:\Users\Ray\github\new-coder\dataviz> pip install numpy
Collecting numpy
Using cached numpy-1.9.2.tar.gz
Installing collected packages: numpy
Running setup.py install for numpy
Any thoughts on what to do? Should I delete the cached file and have it redownload it? I looked in Python27/lib/site-packages and didn't even see numpy and I thought that is where the file should be kept after pip finds them.
EDIT: I added "Can't find a usable init.tcl in the following
directories:" to the title to help anyone else who has this separate problem find the solution posted below.
Numpy is implemented in C and thus requires a C compiler to install. To circumvent the issue, use a precompiled installer from the Source Forge page here. Then try to import to verify the installation.
import numpy # see whether it's been installed
I was able to track down my issue (thanks Malik Brahimi, you led me on the right track to figure this out)
My issue was that I installed the 64bit version of Python, and pip can't install a 64 bit version of numpy because there is no official source.
My solution was to remove python and reinstall a 32 bit version as I don't actually need 64bit and apparently there is better compatibility for modules using 32bit.
I came to another problem later on, where the init.tcl file could not be found when I was running a program that use matplotlib. Python was searching for the init.tcl in python27/bin/tcl8.5 but the correct directory is python27/tcl/tcl8.5 . To fix this I added 2 system variables: TCL_LIBRARY, with the path C:/Python27/tcl/tcl8.5 and TK_LIBRARY, with the path C:/Python27/tcl/tk8.5
you may want to retry using easy_install?
Otherwise, try deleting any cached items.