F
F
Frankdrop2018-09-13 01:07:09
Python
Frankdrop, 2018-09-13 01:07:09

Why doesn't Python see the vk_api library? (ModuleNotFoundError: No module named 'vk_api')?

I'm trying to write a bot for VKontakte in Python 3. OS - Windows 7. I downloaded the vk_api library, installed it using pip install. However, any attempt to call the code from the command line comes out like this:

Traceback (most recent call last):
  File "C:\Python36-32\Scripts\vk_bot.py", line 3, in <module>
    import vk_api
ModuleNotFoundError: No module named 'vk_api'

I searched for an answer for a long time, I even found similar questions on this site, but the advice from there did not help. Added to the path both the Python folder and the Scripts folder, where pip and, accordingly, the code file are located. The Python folder itself is located at the root of the C: drive. The library is explicitly installed because calling pip list or pip3 list lists it along with everything else: So why doesn't Python see it anyway? Maybe it has something to do with the name? Like, the library is called "vk-api", and I'm importing "vk_api" in the code (an underscore instead of a hyphen). But if you write a hyphen, it will give a syntax error. Or maybe something related to Python versions? But I kind of read that vk_api should work for Python 3 as well. So I have no idea what's wrong. What can be done about it?
vk-api (11.0.0)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Fomin, 2018-09-13
@pse17

Try using virtualenv to avoid problems with python versions if you have more than one.
1. Create a virtual environment
2. Install vk_api in it and run the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question