码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu18+virtualenv配置

时间:2019-08-19 17:39:03      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:关系   details   虚拟   env   script   bin   环境   配置   std   

思路:

1、两条命令安装,加sudo是安装在/usr/local/bin/virtualenv路径下,不加就安装在home/.local下。注意,后面bashrc里,要设置的路径和这个有关系,所以要区分清楚

pip3 install virtualenv

pip3 install virtualenvwrapper

 

2、安装完,在bashrc里添加三条命令,第一条指定python版本,第二条指定虚拟环境工作目录,第三条是激活shell下面的快捷命令比如workon等

 

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

 

@ubuntu:~$ source .bashrc
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/premkproject
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/postmkproject
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/initialize
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/premkvirtualenv
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/postmkvirtualenv
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/prermvirtualenv
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/postrmvirtualenv
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/predeactivate
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/postdeactivate
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/preactivate
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/postactivate
virtualenvwrapper.user_scripts creating /home/leiting/.virtualenvs/get_env_details
@ubuntu:~$

执行结果如上。大功告成!

ubuntu18+virtualenv配置

标签:关系   details   虚拟   env   script   bin   环境   配置   std   

原文地址:https://www.cnblogs.com/noobcoder17/p/11378049.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!