本篇内容介绍了“linux平台怎么安装virtualenv”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
1、在root账户下执行
[root@home]# sudo easy_install virtualenv
Searching for virtualenv
Reading https://pypi.python.org/simple/virtualenv/
Best match: virtualenv 15.0.2
Downloading https://pypi.python.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz#md5=0ed59863994daf1292827ffdbba80a63
Processing virtualenv-15.0.2.tar.gz
Writing /tmp/easy_install-cG0DOG/virtualenv-15.0.2/setup.cfg
Running virtualenv-15.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cG0DOG/virtualenv-15.0.2/egg-dist-tmp-cxBl5i
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Adding virtualenv 15.0.2 to easy-install.pth file
Installing virtualenv script to /usr/bin
Installed /usr/lib/python2.7/site-packages/virtualenv-15.0.2-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
2、virtualenv安装完,可以立即打开shell,然后创建自己的环境。通常创建一个项目文件夹,并在其下创建一个env文件夹
[flask@home myproject]$ virtualenv --distribute venv
New python executable in /home/flask/myproject/venv/bin/python
Installing setuptools, pip, wheel...done.
[flask@home myproject]$ ls
venv
[flask@home myproject]$
3、只需要激活相应的环境,就可以在项目中工作,执行
[flask@home myproject]$ source venv/bin/activate
(venv) [flask@homemyproject]$
4、键入以下的命令来激活 virtualenv 中的 Flask:
[flask@home bin]$ pip install flask
“linux平台怎么安装virtualenv”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注天达云网站,小编将为大家输出更多高质量的实用文章!