1. 安装Python3
echo "y" | pkg install python3
ln -sf /usr/local/bin/python3.4 /usr/bin/python
这里安装的Python版本为3.4.4。
为了避免出现No module named ‘setuptools’的错误,须安装对应的包。
安装py-setuptools for python3 :
cd /usr/ports/devel/py-setuptools34
make install clean
或者这样安装:
pkg install py34-setuptools34
2. 安装支持python3的paramiko:
https://github.com/dorianpula/paramiko/tree/python3-support
Paramiko: Python SSH module
Homepage: https://github.com/paramiko/paramiko/
API docs: http://docs.paramiko.org
Requirements
- python 2.5 or better <http://www.python.org/>
- pycrypto 2.1 or better <https://www.dlitz.net/software/pycrypto/>
2.1 安装pycrypto-2.6
pkg install wget
wget http://ftp.riken.jp/sagemath/spkg/upstream/pycrypto/pycrypto-2.6.1.tar.gz
tar xzvf pycrypto-2.6.1.tar.gz
cd pycrypto-2.6.1
python3 setup.py install
遇到的问题/错误:
【 C compiler cannot create executables
解决办法:ln -sf /usr/local/bin/gcc48 /usr/bin/gcc
不知道何时通过pkg install gcc安装了gcc的 4.8.5版本,但是未做软连接到/usr/bin/gcc】
【 Pycrypto install fatal error: gmp.h file not found
解决办法: ln -sf /usr/local/include/gmp.h /usr/include/gmp.h
】
2.2 安装支持python3的paramiko:
pkg install git
git clone https://github.com/dorianpula/paramiko.git
cd paramiko
git checkout python3-support
git branch
python3 setup.py install
rehash
测试一下:
【存在一个错误:No module named ‘six’ 】
解决办法:With Python 3.4 and later, you can use the ensurepip module to install pip on FreeBSD and elsewhere.
Check if pip3 is installed: which pip3
Install the pip3: python3.4 -m ensurepip
Update the pip3: pip3.4 install --upgrade pip
Install the six module: pip3 install six
rehash
再次测试一下:没有报任何错误,OK了。