Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'base58'

I am using Ubuntu 18.04 64 bit version OS I am trying to run my program which convert hex to wif. I used the command python3 hex_to_wif.py to run the program. Then it showed the following error :

Traceback (most recent call last):
  File "hex_to_wif.py", line 1, in <module>
   
 import base58

ModuleNotFoundError: No module named 'base58'

Then I used this command

sudo pip install base58

and it show this:

Requirement already satisfied: base58 in /usr/local/lib/python2.7/dist-packages

How to solve this issue?

like image 891
Bajirao Avatar asked Sep 20 '25 22:09

Bajirao


1 Answers

If you are using python3 to run your program, then you should use pip3 install PACKAGE to install a package. As you are on Ubuntu, you have to be especially careful with that, because python2 is installed by default on your machine, and the python or pip command are probably using Python2.

If using the pip3 command is not enough :

Sometimes, when you have multiple versions of Python installed (with multiple Python 3.X versions), using pip3 is not enough, as it does not necessarily install a package for the latest version of Python installed on your machine. You can check what version of python your pip3 is using by using the pip3 --version command.

If you plan to run some code with Python 3.8 and need to install a package for this specific version of Python, you can use:

pip3.8 install PACKAGE or
python3.8 -m pip install PACKAGE

Then you can run your program using

python3.8 YOURFILE

like image 95
vgalin Avatar answered Sep 22 '25 12:09

vgalin