1. 程式人生 > >Python程式設計:pipenv管理專案虛擬環境

Python程式設計:pipenv管理專案虛擬環境

專案地址:https://github.com/pypa/pipenv

安裝

$ pip install pipenv

使用

在專案根目錄執行以下語句,常用命令如下

$ pipenv install   # 初始化環境

$ pipenv install requests   # 安裝模組
 
$ 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/"