A
A
Anton Nechaev2017-04-07 15:13:20
Python
Anton Nechaev, 2017-04-07 15:13:20

How to fix or properly import modules in PyCharm?

I want to install matplotlib and numpy. I have a miniconda. Tried both via PyCharm built-in download and conda install and pip install.

import matplotlib
x = linspace(0, 5, 10)
y = x ** 2
print(x)
print(y)

Output:
File "C:/Users/PsyhoGhost/Desktop/1/matplotlib.py", line 1, in
import matplotlib
File "C:\Users\PsyhoGhost\Desktop\1\matplotlib.py", line 2, in
x = linspace(0, 5, 10)
NameError: name 'linspace' is not defined
With numpy too.
Thanks everyone, I fixed it myself by creating a new project and installing these modules in the built-in PyCharm loader.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Astrohas, 2017-04-07
@PsyhoGhost

import matplotlib
import numpy
x = numpy.linspace(0, 5, 10)
y = x ** 2
print(x)
print(y)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question