I cant seem to install numpy

2024/10/12 23:31:51

I tried to install numpy, but whenever I start my program, I get these messages.

Error importing numpy: you should not try to import numpy fromits source directory; please exit the numpy source tree, and relaunchyour python interpreter from there.
Traceback (most recent call last):
File "C:\Python34\numpy\__init__.py", line 155, in <module>
from numpy.__config__ import show as show_config
ImportError: No module named 'numpy.__config__'

I don't understand what it means by not importing numpy from it's source directory. Where am I supposed to import it from instead?

Answer

The error means just what it says. You are probably in C:\Python34 or C:\Python34\numpy when you run python on the command line. Switch to another directory (such as C:\) and run python, then try import numpy and see what happens.

From your comments, it looks like you didn't properly install numpy, just unzipped it into your C:\Python34 directory. The easiest way to install this modules is to visit Christoph Gohlke's Python Extension Packages for Windows Repository and go down to numpy. Download the cp34 file for your version of Python (either 32- or 64-bit). Then, on the command line, switch to your Downloads directory and run, for example

pip install numpy‑1.9.2+mkl‑cp34‑none‑win_amd64.whl

(if you downloaded the 64-bit version) and it should install quite nicely. If you get a Command not found error for pip, make sure you add C:\Python34\Scripts to your PATH environment variable. Once you do that, restart the command line and it should work perfectly.

Gohlke has a ton of pre-compiled modules for Python, mostly relating to scientific computing, and I always check there first before installing from PyPI with pip.

https://en.xdnf.cn/q/118147.html

Related Q&A

Using slices in Python

I use the dataset from UCI repo: http://archive.ics.uci.edu/ml/datasets/Energy+efficiency Then doing next:from pandas import * from sklearn.neighbors import KNeighborsRegressor from sklearn.linear_mode…

Elasticsearch delete_by_query wrong usage

I am using 2 similar ES methods to load and delete documents:result = es.search(index=users_favourite_documents,doc_type=favourite_document,body={"query": {"match": {user: user}}})A…

SQLAlchemy: Lost connection to MySQL server during query

There are a couple of related questions regarding this, but in my case, all those solutions is not working out. Thats why I thought of asking again. I am getting this error while I am firing below quer…

row to columns while keeping part of dataframe, display on same row

I am trying to move some of my rows and make the them columns, but keep a large portion of the dataframe the same.Resulting Dataframe:ID Thing Level1 Level2 Time OAttribute IsTrue Score Value 1 …

SQLAlchemy InvalidRequestError when using composite foreign keys

My table relationships in SQLAlchemy have gotten quite complex, and now Im stuck at this error no matter how I configure my relationship.Im a bit new to SQLAlchemy so Im not sure what Im doing wrong, b…

google search by google api in r or python

I want to search some thing (ex:"python language") in google by python or R and it will give me the list of links for that google search like:https://en.wikipedia.org/wiki/Python_(programming…

NumPy Wont Append Arrays

Im currently working on a neural network to play Rock-Paper-Scissors, but Ive run into an enormous issue.Im having the neural network predict what will happen next based on a history of three moves, wh…

(Django) Limited ForeignKey choices by Current User in UpdateView

I recently was able to figure out how to do this in the CreateView, but the same is not working for the UpdateView (Heres the original post on how to do it in the CreateView: (Django) Limited ForeignKe…

Merge list concating unique values as comma seperated retaining original order from csv

Here is my data:data.csvid,fname,lname,education,gradyear,attributes 1,john,smith,mit,2003,qa 1,john,smith,harvard,207,admin 1,john,smith,ft,212,master 2,john,doe,htw,2000,devHere is the code:from iter…

Unable to submit Spark job from Windows IDE to Linux cluster

I just read about findspark and found it quite interesting, as so far I have only used spark-submit which isnt be suited for interactive development on an IDE. I tried executing this file on Windows 10…