20241213 ubuntu python3.7链接问题/ubuntu python3.7安装/pip替换
明昧 Lv7

安装后软链接没有替换

https://serverfault.com/questions/1008708/python-3-7-doesnt-seem-to-want-to-install-still-shows-2-7-17

python安装3.7

Ubuntu 18.04系统内置了Python 3.6和Python 2.7版本,以下是在Ubuntu 18.04系统中安装Python 3.7版本的方法。

1. 执行所有升级

1
2
# sudo apt update
# sudo apt upgrade -y

2. 安装编译Python源程序所需的包

1
2
3
# sudo apt install build-essential -y
# sudo apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y
# sudo apt-get install zlib1g-dev

3. 下载Python 3.7源程序压缩包

1
# wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz

4. 解压缩

1
# tar -xzvf Python-3.7.1.tgz

5. 配置

1
2
# cd Python-3.7.1
# ./configure --enable-optimizations

执行上述语句将启用代码的发布版本,可以优化二进制文件以更好的更快的运行,但是需要运行测试,编译时需要花费一些时间(大约半小时),也可以不进行这一项配置。

6. 编译和安装Python 3.7

1
2
3
# sudo make
# sudo make install
12

7. 查看Python版本

1
2
3
4
5
6
# python3
Python 3.7.1 (default, Nov 21 2018, 16:35:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
12345

出现上述语句说明安装成功。

8. 升级 pip 和更换pip源

1
2
# sudo pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# pip3 install --upgrade pip

参考

  1. Install Python 3.7.0 on Ubuntu 18.04/Debian 9.5
  2. 清华大学pypi 镜像使用帮助

[【Python】Ubuntu 18.04 安装 python3.7_ubuntu18.04 没有libpython3.7m.so.1.0-CSDN博客](file:///C:/Users/Lucinda/Downloads/5004_84325856.html)

安装2

ubuntu16自带的python为python 3.5
可是有些程序需要3.7的环境,怎么办呢??- -你一定在网上找过很多无效的方法了吧,别急,听我慢慢道来

  1. 安装必要依赖
1
2
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
  1. 安装python3.7
1
2
3
4
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
apt-get install python3.7-dev
  1. 安装pip3.7 (与自带的对应python3.5的pip3区分)
1
2
sudo apt install python3-pip
python3.7 -m pip install pip
  1. 使用python3.7 -m pip install <“package”>即可为python3.7装包了
  2. 更新pip3.7
1
python3.7 -m pip install --upgrade pip

安装3

【Python】Ubuntu 18.04 安装 python3.7

img

img有什么不妥img于 2018-11-21 16:56:32 发布

img阅读量2.7wimg 收藏 140

img点赞数 45

分类专栏: Python 文章标签: Python 3.7 Ubuntu 18.04 pip3

版权

Ubuntu 18.04系统内置了Python 3.6和Python 2.7版本,以下是在Ubuntu 18.04系统中安装Python 3.7版本的方法。

1. 执行所有升级

1
2
3
# sudo apt update
# sudo apt upgrade -y
12

2. 安装编译Python源程序所需的包

1
2
3
4
# sudo apt install build-essential -y
# sudo apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y
# sudo apt-get install zlib1g-dev
123

3. 下载Python 3.7源程序压缩包

1
2
# wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
1

4. 解压缩

1
2
# tar -xzvf Python-3.7.1.tgz
1

5. 配置

1
2
3
# cd Python-3.7.1
# ./configure --enable-optimizations
12

执行上述语句将启用代码的发布版本,可以优化二进制文件以更好的更快的运行,但是需要运行测试,编译时需要花费一些时间(大约半小时),也可以不进行这一项配置。

6. 编译和安装Python 3.7

1
2
3
# sudo make
# sudo make install
12

7. 查看Python版本

1
2
3
4
5
6
# python3
Python 3.7.1 (default, Nov 21 2018, 16:35:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
12345

出现上述语句说明安装成功。

8. 升级 pip 和更换pip源

1
2
# sudo pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# pip3 install --upgrade pip
 Comments
Comment plugin failed to load
Loading comment plugin
Powered by Hexo & Theme Keep
Unique Visitor Page View