Skip to content
Advertisement

I am having a trouble importing the PyDictionary library

Basically, I downloaded the library using pip install PyDictionary and I made sure it exists by writing the same thing again and this appeared:

JavaScript

However, when I try to run this simple program in atom, it says module not found. This is the program:

JavaScript

This is the error:

JavaScript

The only way I found to execute the program correctly was by moving the file to the folder where the library exists so that atom can find the library. The weird thing is that the library numpy works perfectly. I would really like an answer to this problem.

Advertisement

Answer

What you’re having issues with is that your pip command, is not connected to your installation of python3.

If you’re using Windows, then you should have a “python launcher” that you can use to double-check your installed versions of Python like this:

JavaScript

Here you can see that I have two versions of Python installed on my device. So, let’s check what both of those installations has installed using their own versions of pip.

Let’s start with my 3.7 installation:

JavaScript

Here we can see that I have three packages installed.

Now let’s check my 3.9 installation:

JavaScript

What I am doing above basically, is calling the different python installations, and opening it with the following flag:

JavaScript

The pip command is basically just an alias for <python-installation> -m pip, so when I issue the above command, I am launching pip with a specific python-installation.


If you do not have the “python-launcher” that I have in my above examples, but you have different aliases for your python-interpreters, then you can issue the same commands in the same way, just using your aliases.

Here are a couple of examples:

JavaScript

And you can obviously issue other commands to pip using that same logic, so if you want to install a package for a specific version you can do something like:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement