I have to use a script written in Python 3 which requires paramiko
.
I installed paramiko
by doing:
pip install paramiko
and got:
Requirement already satisfied (use --upgrade to upgrade): paramiko in /usr/lib/python2.7/dist-packages Requirement already satisfied (use
--upgrade to upgrade): pycrypto>=2.1,!=2.4 in /usr/lib/python2.7/dist-packages (from paramiko) Cleaning up...
I tried executing import paramiko
for Python and Python 3 and it did not work for Python 3, as given below:
Python:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>>
Python 3:
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] 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'
>>>
How can I make paramiko
visible to Python 3?
As you can see from the path pip shows:
/usr/lib/python2.7/
You have paramiko
isntalled in Python 2.7 and not 3.
Use pip3
(python installer for 3.x version) with pip3 install paramiko
(using sudo
if necessary) or python3 -m pip install paramiko
to get the version of pip
which installs to the directory for Python 3.
check if pip3 is installed
which pip3
then
pip3 install paramiko
if that doesn't work, download the package and unzip it.
python3 setup.py install
and that'll work for sure.
Plus, if you're running a fun distro of linux with a package manager, you can dnf/yum/zyppr/apt-get install python3-paramiko
$ sudo -H pip3 install paramiko --ignore-installed
First, you are using pip and not pip3 tries to install pip3 (sudo apt install python3-pip) and run the command pip3 install paramiko If the error continues to, verify the version of ubuntu. If the version is 16, it uses python3 version 3.5.2 (paramiko don't work in this version), so I recommend upgrading to 18 because python3 version is 3.6.8 and paramiko will be installed successfully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.