Thank you, but the output you provided is only for one interpreter.
Anyway, you don't have numpy installed for the interpreter which is selected as project interpreter in PyCharm. In command line you're probably using different interpreter (another python environment?).
@Andrey Resler : i renamed it and created new file too but same thing happen and this is the output i get.. here is the attachment: Please help me for this.
Hi,
Are you sure numpy is installed for this interpreter?
Please try running your script from the command line outside of IDE using the same interpreter.
@Andrey Resler ya it is installed for this interpreter and my script is running on both idle and cmd line but not in pycharm
Ok, let's look a bit deeper. Please run the following snippet (https://gist.github.com/aresler/22c59d7883fd57dddb4c57a7f96603d6) from PyCharm, and from the command line where everything is working. Provide the outputs for comparison.
Thank you, but the output you provided is only for one interpreter.
Anyway, you don't have numpy installed for the interpreter which is selected as project interpreter in PyCharm. In command line you're probably using different interpreter (another python environment?).
The error you see when installing numpy are missing C++ build tools, which you can install from here: https://visualstudio.microsoft.com/visual-cpp-build-tools/
@Andrey Resler
Please help me :
numpy package is installed properly in pycharm ..... but code is not running
u provide me one code i run tht code i got this output ....
C:\Users\Aditi\PycharmProjects\python_codes\venv\Scripts\python.exe C:/Users/Aditi/PycharmProjects/python_codes/numpy.py
{'PATH': ['C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\Scripts',
'C:\\app\\Aditi\\product\\11.2.0\\dbhome_1\\bin',
'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath',
'C:\\WINDOWS\\system32',
'C:\\WINDOWS',
'C:\\WINDOWS\\System32\\Wbem',
'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\',
'C:\\WINDOWS\\System32\\OpenSSH\\',
'C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine '
'Components\\DAL',
'C:\\Program Files\\Intel\\Intel(R) Management Engine '
'Components\\DAL',
'C:\\Program Files\\Intel\\WiFi\\bin\\',
'C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts',
'C:\\Users\\Aditi\\AppData\\Local\\Microsoft\\WindowsApps',
'',
'C:\\Program Files\\JetBrains\\PyCharm Community Edition '
'2019.3.3\\bin',
''],
'PYTHONPATH': ['C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\Scripts',
'C:\\app\\Aditi\\product\\11.2.0\\dbhome_1\\bin',
'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath',
'C:\\WINDOWS\\system32',
'C:\\WINDOWS',
'C:\\WINDOWS\\System32\\Wbem',
'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\',
'C:\\WINDOWS\\System32\\OpenSSH\\',
'C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine '
'Components\\DAL',
'C:\\Program Files\\Intel\\Intel(R) Management Engine '
'Components\\DAL',
'C:\\Program Files\\Intel\\WiFi\\bin\\',
'C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts',
'C:\\Users\\Aditi\\AppData\\Local\\Microsoft\\WindowsApps',
'',
'C:\\Program Files\\JetBrains\\PyCharm Community Edition '
'2019.3.3\\bin',
''],
'pkg_resources.working_set': [numpy 1.18.2 (c:\users\aditi\pycharmprojects\python_codes\venv\lib\site-packages),
setuptools 40.8.0 (c:\users\aditi\pycharmprojects\python_codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg),
pip 19.0.3 (c:\users\aditi\pycharmprojects\python_codes\venv\lib\site-packages\pip-19.0.3-py3.8.egg)],
'sys.executable': 'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\Scripts\\python.exe',
'sys.path': ['C:\\Users\\Aditi\\PycharmProjects\\python_codes',
'C:\\Users\\Aditi\\PycharmProjects\\python_codes',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
'C:\\Users\\Aditi\\AppData\\Local\\Programs\\Python\\Python38-32',
'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv',
'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\lib\\site-packages',
'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\lib\\site-packages\\setuptools-40.8.0-py3.8.egg',
'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv\\lib\\site-packages\\pip-19.0.3-py3.8.egg'],
'sys.prefix': 'C:\\Users\\Aditi\\PycharmProjects\\python_codes\\venv',
'sys.version_info': sys.version_info(major=3, minor=8, micro=2, releaselevel='final', serial=0)}
You should rename your file from "numpy.py" to something else. It shadows the name "numpy" from the installed module.
@Andrey Resler : i renamed it and created new file too but same thing happen and this is the output i get.. here is the attachment: Please help me for this.
Please provide full screenshot of the issue capturing the whole IDE window so your project structure is visible.
Use "Go to declaration" feature of PyCharm on numpy import and see where it leads: https://www.jetbrains.com/help/pycharm/navigating-through-the-source-code.html#go_to_declaration
hey thanks its working now