pip install pyinstaller 默认 pip 使用的是国外的镜像,下载的时候非常慢 清华大学的源,地址为: https://pypi.tuna.tsinghua.edu.cn/simple
其他国内源: 清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
我们可以直接在pip命令中使用-i参数来指定镜像地址,例如:
pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple
2.终端命令替换
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
3.临时性使用 在安装库的时候,临时需要用到某个镜像,这里以清华大学镜像为例下载pandas库:
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple/
python 1.导出
查看当前安装的包
pip list
导出当前安装的包记录
pip freeze > ./requirements.txt 2. 导入
用anaconda创建一个虚拟环境
conda create -n py37 python=3.7
激活当前py37环境
MAC/Linux: source activate py37 WIndows: activate py37
导入安装之前的包列表
pip install -r ./requirements.txt