Issue
I installed the paramiko
lib with Ubuntu's APT repositories (sudo apt-get install python3-paramiko
), and I can't import it :
$ python3
Python 3.5.2 (default, Jul 5 2016, 12:43:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'paramiko'
But when I install it with pip3 install paramiko
, the import paramiko
line works !
I could just stick with the pip
version, but I want to distribute this program, and it would be very convenient to give all the dependencies as APT packages.
Why can Python import the pip
version, but not the APT one ?
Solution
Maybe the apt package is installed to a dir not recognized by python3, that is, not in one of sys.path
. compare the installed dir of python3-paramiko and the output of python3 -c 'import sys;print(sys.path)'
.
Also, it's good practice for your python package to depend on packages installed by pip. Since you could distribute your package via setuptools
and configure your dependency therein. Which make your program cross platform.
Answered By - flyingfoxlee Answer Checked By - Robin (WPSolving Admin)