发布时间:2019-07-15 10:49:39编辑:auto阅读(1337)
# 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开发实战(日版)
上一篇: python --日期输出学习
下一篇: python pip源配置
47483
45786
36783
34310
28955
25589
24436
19606
19096
17626
5458°
6041°
5557°
5632°
6558°
5370°
5370°
5877°
5850°
7163°