James Lin
James Lin

Reputation: 26538

python ImportError: No module named package

Given the following structure

abc
├── __init__.py
└── package
    ├── __init__.py
    ├── __init__.pyc
    ├── client.py
    ├── client.pyc
    ├── server.py
    └── server.pyc

when I run python in command line outside of abc and try to import package as below:

ImportError: No module named package

Any ideas?

Upvotes: 1

Views: 4935

Answers (2)

user1270589
user1270589

Reputation:

I was able to get pip working again by doing the following :

cd /tmp/
wget https://bootstrap.pypa.io/get-pip.py
sudo apt-get purge -y python3-pip
sudo python3 ./get-pip.py
sudo apt-get install python3-pip

Upvotes: 1

NPE
NPE

Reputation: 500357

If you are importing package, as opposed to abc.package, you need to put abc onto PYTHONPATH.

Upvotes: 3

Related Questions