Linux 安装配置python3

步骤:

第一步:下载python3压缩包

1、先在usr目录中创建准备一个文件夹py

mkdir py

2、下载python3 压缩包

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz (压缩文件会自动下载到当前目录下)

3、解压Python-3.6.0.tgz

tar Python-3.6.0.tgz

4、生成配置文件到/usr/demo下

./configure --prefix=/usr/demo --with-ssl (--with-ssl 可解决pip无法找到ssl的问题)

5、编译(需要切换到python3.6.0的目录下)

make

6、安装(需要切换到python3.6.0的目录下)

make install

如果报错。检查最后缺少的模块名去下载即可

7、建立软连接

ln -s /usr/demo/python-3.6.0/bin/python3 /usr/bin/python3

8、建立pip软连接

ln -s /usr/demo/python-3.6.0/bin/pip3 /usr/bin/pip3

9、输入python3 -V 查看版本,pip3 -V查看版本。(配置完毕)

10、更改pip3源有助于下载安装模块。

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

mkdir ~/.pip

vim ~/.pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple/

[install]

trusted-host = pypi.tuna.tsinghua.edu.cn

 

posted @ 2019-11-02 16:45  Demo_one  阅读(181)  评论(0)    收藏  举报