项目地址:
https://github.com/pypa/pipenv
安装
$ pip install pipenv
使用
在项目根目录执行以下语句,常用命令如下
$ pipenv --python 3.6 # 使用python 3.6 创建虚拟环境 $ pipenv install # 初始化环境 $ pipenv install requests # 安装模块 $ pipenv install requests --dev # 开发环境依赖 $ pipenv --rm # 移除环境 $ pipenv graph # 查看已安装的包 $ pipenv shell # 启动shell $ pipenv uninstall --all # 卸载所有 $ pipenv run python hello.py # 运行脚本 $ pipenv -h # 查看帮助
会多出来两个文件Pipfile, Pipfile.lock
修改pip源
Pipfile文件用记事本打开修改url后面的值为清华大学源
[[source]] # url = "https://pypi.org/simple" url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
经过多次尝试,发现坑比较多, 还是选择pyenv