16

I have done through the other questions online here, and I feel that mine is different enough to warrant a new question.

So I have a Centos 6 box, which is running a small website for me, acts as an office git server and I am trying to configure Python3 on it.

So I followed the following these steps to set up python3 on the server. However it seems that I cannot import paramiko into my script.

I downloaded the paramiko rpm however I get this message:

When I try to import paramiko I get:

[root@GIT Python-3.4.2]# rpm -ivh /usr/lib/Python-3.4.2/Modules/python-paramiko-1.7.5-2.1.el6.noarch.rpm
Preparing...                ########################################### [100%]
package python-paramiko-1.7.5-2.1.el6.noarch is already installed

When I run python3 directly:

[root@GIT inserv_health_check]# python3
Python 3.4.2 (default, Jan 21 2015, 06:28:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] 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'
>>>

I am sure there is a simple solution to this problem perhaps the path is wrong, or I should have put a symbolic link in somewhere. Any help would be appreciated :)

Before anyone asks, which python output:

[root@GIT Python-3.4.2]# which python
/usr/bin/python
[root@GIT Python-3.4.2]# which pytho~n3
/usr/bin/which: no pytho~n3 in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@GIT Python-3.4.2]# which python3
/usr/local/bin/python3

Thanks

Radouane ROUFID
  • 10,595
  • 9
  • 42
  • 80
jeff_h
  • 519
  • 1
  • 9
  • 26

2 Answers2

11

You need to do pip install paramiko so that python sees that module. If you work on a virtual environment, you need to workon <env_name> first and then pip install the desired module.

Kostas Livieratos
  • 965
  • 14
  • 33
  • pip install paramiko, I got the following error: error: command 'gcc' failed with exit status 1 Rolling back uninstall of pycrypto Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-w6kSsj-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/pycrypto Storing complete log in /root/.pip/pip.log – jeff_h Jan 27 '15 at 15:13
  • Also: Package gcc-4.4.7-11.el6.x86_64 already installed and latest version – jeff_h Jan 27 '15 at 15:17
  • run `sudo apt-get install libffi-dev` and `sudo apt-get install libssl-dev` and try again – Kostas Livieratos Jan 27 '15 at 15:39
  • It is a centos box, so its yum not apt-get :) Ran both commands got the response, nothing to do :( – jeff_h Jan 27 '15 at 18:11
6

type pip3 install paramiko

if you want to install it for python3

jizhihaoSAMA
  • 12,336
  • 9
  • 27
  • 49
m Piroli
  • 333
  • 3
  • 6
  • 2
    pip3 install paramiko solved the issue in my case. Plain pip install paramiko didn't work. – Flaviu Nov 23 '20 at 07:15