Python imports not found

Asked

Viewed 596 times

-1

I am facing some problems with downloaded Imports with pyPI, more specifically Imports Pypi Wikipedia and Google... I install both via Pip install and they can be found in the site-Packages folder in Python. But in Imports they don’t work. Environment (Windows 10 and Windows 7): In both of them I’m using Vscode to program in Python, other Imports like chatterbot work perfectly, but these 2 above do not work. I realized that if I create a new document and program, make the import of the wikipedia class works, I can use its methods perfectly, but to run, when saving in a folder on the desktop for example, the import wikipedia simply ceases to be recognized.

import wikipedia

wikipedia.set_lang('pt')

print(wikipedia.search("Barack"))

I don’t know when saving the file, it can no longer track wikipedia inside the folder site-Packages, but chatterbot for example, is in this same folder and I don’t have this problem.

  • In this file you are using the correct interpreter? Vscode may have configured a different interpreter.

  • I am, if I import another library as the or datetime for example, it recognizes normally, but this wikipedia does not recognize if I try to use the method . search or set_lang or any other, it’s like this library doesn’t have these methods. BUT !

1 answer

0

I managed to solve my problems, I actually needed to configure virtualenv, probably because some of these Imports really needed it, so I ran this command:

pip.exe install virtualenv

and now it works perfectly.

Browser other questions tagged

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