安装python:
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz tar xf Python-3.6.3.tgz cd Python-3.6.3 #安装编译依赖包 sudo apt-get install openssl sudo apt-get install zlib1g-dev #检查环境,编译安装 ./configure --with-ssl #这个参数必须加上,否则默认python安装的软件不可使用ssl模块,后面的pip将不可用 make && make install
rm -f /usr/bin/python ln -s /usr/local/bin/python3.6 /usr/bin/python python --version
安装pip:
wget https://pypi.python.org/packages/41/80/268fda78a53c2629128f8174d2952c7f902c93ebaa2062b64f27aa101b07/setuptools-38.2.3.zip#md5=0ae64455d276ff864b40aca9c06ea7c1 unzip setuptools-38.2.3.zip cd setuptools-38.2.3 python setup.py install
#如果缺少zlib包,则安装就是;不缺少的话,直接安装pip
wget http://zlib.net/zlib-1.2.11.tar.gz tar -xvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make make install
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9 tar xf pip-9.0.1.tar.gz cd pip-9.0.1 python setup.py install
pip安装软件 遇到的错误:
1. 找不到ssl模块
python编译未加ssl参数,重新编译:
./configure --with-ssl
make
make install
pip即可用。
2. 超时 Read timed out
设置超时时间 pip --default-timeout=100 install -U ¥module
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/2656.html