Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Installed a local package with pip3, but got module not found error

Tags:

python-3.x

pip

Procedure:

  • I strictly followed the instructions here: https://python-packaging.readthedocs.io/en/latest/minimal.html
  • Except that I used the pip3 install -e .

Error:

It still can not find the module:

python3
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
import funniest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'funniest'

However, when I import the module in python, it CAN find it:

python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
import funniest

My python:

sys.executable
'/usr/local/opt/python/bin/python3.6'

Question

Why pip3 installed it for python 2.7 not for my python 3.x ?

Thanks!

like image 337
askmeasku Avatar asked Jun 01 '18 12:06

askmeasku


People also ask

How do I know what packages are installed in pip3?

List Installed Packages with Pip. Both pip list and pip freeze will generate a list of installed packages, just with differently formatted results. Keep in mind that pip list will list ALL installed packages (regardless of how they were installed). while pip freeze will list only everything installed by Pip.

How do I install a Python module locally?

To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.


1 Answers

Following the hint from @hoefling, I found that my pip3 is somewhat linked to a wrong python version.

Then install with python3 -m pip install worked.

like image 150
askmeasku Avatar answered Oct 09 '22 10:10

askmeasku