Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using numpy as chart
#1
I have the following code:

import numpy as np
import matplotlib.pyplot as plt

xlist = np.linspace(-3.0, 3.0, 100)
ylist = np.linspace(-3.0, 3.0, 100)

X, Y = np.meshgrid(xlist, ylist)
Z = np.sqrt(X**2 + Y**2)

fig,ax=plt.subplots(1,1)
cp = ax.contourf(X, Y, Z)
fig.colorbar(cp) # Add a colorbar to a plot
ax.set_title('Filled Contours Plot')

#ax.set_xlabel('x (cm)')
ax.set_ylabel('y (cm)')
plt.show()
When I run this code, I got this error message:

No module named numpy

Well, I have numpy installed, but in C:\Program Files (x86)\Python36-32\Lib\site-packages, and I need it into C:\Program Files\Python36\Lib\site-packages. You would say, why don't you install it where you need ? Well, I tried this too, but I got:

PS C:\Program Files\Python36> pip install numpy
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy in c:\program files (x86)\python36-32\lib\site-packages (1.19.2)

How can I solve this issue ? How can I setup VSCode to use my numpy from 32 bit Program Files instead of Program Files ?
Reply
#2
Do you have 64bit OS and 32bit python ?
flaviu2 likes this post
Reply
#3
(Nov-14-2020, 09:59 PM)Axel_Erfurt Wrote: Do you have 64bit OS and 32bit python ?
I have 64bit system, and in this configuration I want the application, I mean 64bit.
Reply
#4
But you have a 32bit python installed, so pip installs the modules in the folder program files (x86)
flaviu2 likes this post
Reply
#5
I have installed all packages in 32 bit side: https://ibb.co/VH1ByBj

Now I should uninstall Python 32bit and let 64bit Python as it is and install all this packages in 64bit side ? Can I used both (32 and 64) and choose what I need depending of my developed app ?
Reply
#6
If somebody else will have the same problem: I uninstall all Python from my PC, and I install it Python 3.6.8 64 bit only, and everything is ok.

Thank you for your assistance.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020