# 安装python3.6下的虚拟环境程序
(envsp) ubuntu@VM-0-2-ubuntu:~$ sudo apt-get install python3.6-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
python3.6-venv
0 upgraded, 1 newly installed, 0 to remove and 251 not upgraded.
Need to get 1,594 kB of archives.
After this operation, 1,755 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu xenial/main amd64 python3.6-venv amd64 3.6.2-1+xenial1 [1,594 kB]
Fetched 1,594 kB in 3s (430 kB/s)
Selecting previously unselected package python3.6-venv.
(Reading database ... 67904 files and directories currently installed.)
Preparing to unpack .../python3.6-venv_3.6.2-1+xenial1_amd64.deb ...
Unpacking python3.6-venv (3.6.2-1+xenial1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python3.6-venv (3.6.2-1+xenial1) ...
# 使用python3.6下的venv创建虚拟环境venvsix(名称可自定义)
(envsp) ubuntu@VM-0-2-ubuntu:~$ python3.6 -m venv venvsix
(envsp) ubuntu@VM-0-2-ubuntu:~$ ls
envsp Python-3.7.1.tgz venv venvsix wget-log
# 激活对应虚拟环境
(envsp) ubuntu@VM-0-2-ubuntu:~$ source venvsix/bin/activate
# 查看当前环境下默认python版本信息
(venvsix) ubuntu@VM-0-2-ubuntu:~$ python3 --version
Python 3.6.2
(venvsix) ubuntu@VM-0-2-ubuntu:~$ python --version
Python 3.6.2
(venvsix) ubuntu@VM-0-2-ubuntu:~$
网友评论