python安装地址:https://www.python.org/ftp/python/
在ubuntu里,zlib叫zlib1g,相应的zlib-devel叫zlib1g.dev。默认的安装源里没有zlib1g.dev。要在packages.ubuntu.com上找。
$sudo apt-get install ruby
然后再装zlib1g-dev就可以了
$sudo apt-get install zlib1g-dev
1. 安装必备的软件包
centos: yum -y groupinstall development zlib zlib-devel
ubuntu: sudo apt-get install zlib1g-dev
2. 下载python3.6
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
cd Python-3.6.0
./configure
make
make install
3. 检查是否成功
which python3
python3 -V
4. 创建软链接
cd /usr/bin
mv python python.backup
ln -s /usr/local/bin/python3 /usr/bin/python
检测
>>> python3.6
安装pip3
1.官网下载zip包。
https://pypi.python.org/pypi/setuptools
tar -zxvf setuptools-19.6.tar.gz //解压
cd setuptools-19.6
python3 setup.py build//编译
python3 setup.py install //安装
install 的时候会报错,我们需要在linux中安装zlib-devel包,进行支持。
yum install zlib-devel
需要对python3.5进行重新编译安装
cd Python3.5
make && make install
再重新安装setuptools
python3 setup.py build
python3 setup.py install
安装pip
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
- ImportError: cannot import name 'HTTPSHandler'
yum install openssl-devel
==继续重新安装编译python3.5(其他的不需要重新编译)==
error
Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
then compile it again.
ori url: https://stackoverflow.com/questions/27022373/python3-importerror-no-module-named-ctypes-when-using-value-from-module-mul