拉钩4.1-pip依赖管理和虚拟环境

1、pip

 流行库:PyPI · The Python Package Index

帮助:pip help

安装库:pip install 包名

安装指定版本的库:如  pip install selenuim==3.8.1

卸载库:pip uninstall 包名

升级库:pip install -U 包名

列出已安装的库:pip list

 

国内镜像源:

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:http://mirrors.aliyun.com/pypi/simple/

豆瓣:http://pypi.douban.com/simple/

 

pip install -i 镜像地址 --trust-host 镜像地址对应的host

如:pip install jupyter -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 

 pip install --proxy http://w30012731:jing@0314@openproxy.huawei.com:8080 --index-url http://pypi.douban.com/simple/ allure --trusted-host pypi.douban.com

2、虚拟环境

12. Virtual Environments and Packages — Python 3.9.7 documentation

以下以macOS为准

1、命令行创建虚拟环境

  • 创建虚拟环境
  • 激活虚拟环境
  • 退出虚拟环境:deactivate

 

 2、pycharm创建虚拟环境

  • 创建虚拟环境
  • 激活虚拟环境 
  • 安装库
posted @ 2021-09-01 20:55  TXBB哭哭  阅读(49)  评论(0编辑  收藏  举报