标签:virutalenv
# pip源设置 [root@saltstack-ui ~]# cat /root/.pip/pip.conf [global] trusted-host=pypi.douban.com # 这个在virtual env中会提示这个,配置就不提示了 index-url=http://pypi.douban.com/simple
[root@saltstack-ui ~]# pip install virtualenv # 安装virtualenv [root@saltstack-ui ~]# virtualenv env # 初始化一个虚拟环境,名为env New python executable in env/bin/python Installing setuptools, pip, wheel... done. [root@saltstack-ui ~]# ls env/ bin include lib lib64 pip-selfcheck.json share
[root@saltstack-ui ~]# source env/bin/activate # 进入虚拟环境 (env)[root@saltstack-ui ~]# pip list # 查看装了哪些pip包 ipython (3.1.0) Mako (1.0.1) MarkupSafe (0.23) pip (7.0.3) setuptools (17.0) wheel (0.24.0) (env)[root@saltstack-ui ~]# pip install jinja Collecting jinja Downloading http://pypi.douban.com/packages/source/J/Jinja/Jinja-1.2.tar.gz (252kB) 100% |████████████████████████████████| 253kB 4.2MB/s Building wheels for collected packages: jinja Running setup.py bdist_wheel for jinja Stored in directory: /root/.cache/pip/wheels/b5/7e/80/ee19590e5bb4e85318e3de197ff9afd26d8c75a4a34a08b815 Successfully built jinja Installing collected packages: jinja Successfully installed jinja-1.2 (env)[root@saltstack-ui ~]# pip list # 再次查看安装了哪些pip包 ipython (3.1.0) Jinja (1.2) Mako (1.0.1) MarkupSafe (0.23) pip (7.0.3) setuptools (17.0) wheel (0.24.0) (env)[root@saltstack-ui ~]# deactivate # 退出虚拟环境
参考链接:python开发实战(日版)
本文出自 “the-way-to-cloud” 博客,请务必保留此出处http://iceyao.blog.51cto.com/9426658/1660232
标签:virutalenv
原文地址:http://iceyao.blog.51cto.com/9426658/1660232