ubuntu18+virtualenv配置
Posted noobcoder17
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu18+virtualenv配置相关的知识,希望对你有一定的参考价值。
思路:
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配置的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu18.04中安装virtualenv和virtualenvwrapper
Ubuntu18.04中安装virtualenv和virtualenvwrapper
为啥 `virtualenv` 找不到 `pkg_resources`?