reference:
http://stackoverflow.com/questions/22073516/failed-to-install-python-cryptography-package-with-pip-and-setup-py
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
[sudo] password for wgz:
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
python-dev is already the newest version (2.7.11-1).
The following NEW packages will be installed:
libffi-dev libssl-dev libssl-doc zlib1g-dev
0 upgraded, 4 newly installed, 0 to remove and 22 not upgraded.
Need to get 2,800 kB of archives.
After this operation, 11.1 MB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 zlib1g-dev amd64 1:1.2.8.dfsg-2ubuntu4 [168 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-dev amd64 1.0.2g-1ubuntu4.2 [1,393 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-doc all 1.0.2g-1ubuntu4.2 [1,078 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libffi-dev amd64 3.2.1-4 [161 kB]
Fetched 2,800 kB in 2s (1,219 kB/s)
Selecting previously unselected package zlib1g-dev:amd64.
(Reading database ... 208674 files and directories currently installed.)
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.0.2g-1ubuntu4.2_amd64.deb ...
Unpacking libssl-dev:amd64 (1.0.2g-1ubuntu4.2) ...
Selecting previously unselected package libssl-doc.
Preparing to unpack .../libssl-doc_1.0.2g-1ubuntu4.2_all.deb ...
Unpacking libssl-doc (1.0.2g-1ubuntu4.2) ...
Selecting previously unselected package libffi-dev:amd64.
Preparing to unpack .../libffi-dev_3.2.1-4_amd64.deb ...
Unpacking libffi-dev:amd64 (3.2.1-4) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4) ...
Setting up libssl-dev:amd64 (1.0.2g-1ubuntu4.2) ...
Setting up libssl-doc (1.0.2g-1ubuntu4.2) ...
Setting up libffi-dev:amd64 (3.2.1-4) ...
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$ pip install --no-index --find-links='.' cryptography
Ignoring indexes: https://pypi.python.org/simple
Collecting cryptography
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cffi>=1.4.1->cryptography)
Building wheels for collected packages: cryptography
Running setup.py bdist_wheel for cryptography ... done
Stored in directory: /home/wgz/.cache/pip/wheels/a8/80/a8/4740865732eb1274f08b656a4e0295fce78a686f064bc889ec
Successfully built cryptography
Installing collected packages: cryptography
Successfully installed cryptography-1.5
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$ pip freeze
cffi==1.8.2
cryptography==1.5
idna==2.1
pyasn1==0.1.9
pycparser==2.14
six==1.10.0
(test) wgz@wgz:~/Desktop/ssh/pip3-crypto$
(test) wgz@wgz:~/Desktop/ssh$ pip install --no-index --find-links='.' paramiko
Ignoring indexes: https://pypi.python.org/simple
Collecting paramiko
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from paramiko)
Requirement already satisfied (use --upgrade to upgrade): cryptography>=1.1 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from paramiko)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/wgz/.virtualenvs/test/lib/python3.5/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko)
Installing collected packages: paramiko
Successfully installed paramiko-2.0.2
(test) wgz@wgz:~/Desktop/ssh$
(test) wgz@wgz:~/Desktop/ssh$ pip freeze
cffi==1.8.2
cryptography==1.5
idna==2.1
paramiko==2.0.2
pyasn1==0.1.9
pycparser==2.14
six==1.10.0
(test) wgz@wgz:~/Desktop/ssh$