Jump to content
IPS Community Suite 简体中文
Sign in to follow this  
ipscn

Installing Python 3 and pip in Ubuntu

Recommended Posts

安装 Python 3

sudo apt update
sudo apt upgrade
sudo apt install python3

检查安装结果

uuu@uuu:~/文档$ common -v python
common:未找到命令
uuu@uuu:~/文档$ whereis python3
python3: /usr/bin/python3.6m /usr/bin/python3.6-config /usr/bin/python3.6 /usr/bin/python3.6m-config /usr/bin/python3 /usr/lib/python3.7 /usr/lib/python3.6 /usr/lib/python3 /etc/python3.6 /etc/python3 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/include/python3.6 /usr/share/python3 /usr/share/man/man1/python3.1.gz

查看Python3的版本

python3 -V

我的输出是

Python 3.6.6

安装 pip3

sudo apt install -y python3-pip

安装附加的构建工具

sudo apt install build-essential libssl-dev libffi-dev python3-dev

安装语法提示工具

sudo pip3 install pylint

安装 venv

sudo apt install -y python3-venv

创建虚拟环境

cd ~
mkdir pyenv
cd pyenv
python3.6 -m venv pyenv

启用虚拟环境

source pyenv/bin/activate

2018-10-16 21-12-08 的屏幕截图.png

此时输入 python

2018-10-16 21-13-26 的屏幕截图.png

 

输入 quit() 或者 eixt() 退出python 的shell,然后可以输入 deactivate 退出这个虚拟环境

 

2018-10-16 21-14-30 的屏幕截图.png

 

在 Python 项目中使用这个模板:

cp -r ~/pyenv/pyenv ./pyenv

2018-10-16 21-16-57 的屏幕截图.png

 

source pyenv/bin/activate

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×