How to run a code outside a directory in Python?

Asked

Viewed 198 times

0

I tried to run the code Código que quero rodar

saved on desktop. However, Python Shell showed Mensagem de erro

Could you help me?

Thank you, Marcos Miotti

  • See the answer in this link. http://stackoverflow.com/questions/34164960/cant-find-numpy-in-windows-8 .

1 answer

0


Install the numpy through the Miniconda, using the command

conda install numpy

After that, include the directory of numpy in the folder of Miniconda using the command

sys.path.append(DIRETÓRIO)

From there it will be possible to do the import numpy, no error messages :)

Marcos Miotti

  • The problem is that every time I try to import Numpy, it appears Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. That’s why I do it.

  • Above I put the link with another question I asked, on Stackoverflow in English

  • You’re running your code from the Numpy code directory, is that it, Marcos? If it is, remove your code and put it on your desktop, so it is well able to work

  • Marcos, I just saw your last comment on Stackoverflow in English, for you to run a code out of the numpy directory just save your code on the desktop and try to run it!

  • It was not in the Numpy directory. However, I changed the code to my desktop and even then the above message appeared.

  • I changed my question, Vinicius. Look there.

  • Marcos, try to run this code directly in SHELL Python, so we will know the origin of the problem!

  • The same error message appears when I run the code directly in the Python Shell

  • I recommend then that you reinstall numpy, so it might solve your problem

  • SOLUTION I FOUND: add to sys.path the directory of numpy installed with the Miniconda. Thank you very much, Vinicius.

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.