纯手打,转载务请附上本文网址!!!

楼主是在/usr/local目录下进行操作的,所以需要root进行

先说Python3.6.4的安装

首先呢,你需要下载Python3.6.4的资源包,楼主的系统时linux 64位的

sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

下载完成之后解压

sudo tar -xvf Python-3.6.4.tgz

再进行以下步骤,就基本算完成了

./configure --with-ssl
sudo make
sudo make install

这里的第一句./configure --with-ssl一定不能掉,否则安装完成之后pip3 install的时候很有可能会出现问题

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Could not fetch URL https:*******: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skippingpip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https:*******: There was a problem confirming the ssl certificate: 
Can't connect to HTTPS URL because the SSL module is not available. - skipping

最后在/usr/bin目录中创建硬链接

ln -s /usr/local/python3.6.4/bin/python3 /usr/bin/python3.6

在终端中输入python3.6,看到如下便表示Python3.6.4安装成功了

 

再说Python3.6.4中pip3的配置

接下来是Python3.6.4中pip3的配置,为什么要用其中的pip3呢,因为系统中默认的是Python2的环境,pip install安装到的是Python2的环境中,不是你现在装的Python3.6.4的环境

另外说一点:记住千万不要去改这个Python2和系统自带的别的Python的环境,系统有很多命令是依赖于自带的Python环境,如果不是很了解千万就别去改这些东西

sudo ln -s /usr/local/python3.6.4/bin/pip3 /usr/bin/pip3

打开终端,输入pip3 -V,看到以下画面表示安装成功

最后说一句使用pip3安装推荐使用以下命令哦

sudo -H pip3 install  XXXXXX
Logo

更多推荐