一、 pycharm导出依赖包以及批量导入依赖包
1、导出依赖包
pip freeze > filename.txt,filename可以自己定义
2、新环境下安装移植项目依赖的第三方库
pip install -r filename.txt
可以先将所有要安装的库列在txt文件中,然后再执行pip install -r filename.txt批量安装
二、在pycharm中配置默认镜像源
在下载包时,容易出现超时等问题,主要是因为python库的服务器都在国外,国内下载会很慢,所以,可以配置国内镜像源来加快下载
国内常用的镜像源
1、清华:https://pypi.tuna.tsinghua.edu.cn/simple
2、豆瓣:http://pypi.douban.com/simple
3、阿里云:http://mirrors.aliyun.com/pypi/simple
4、中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple
5、华中理工大学:http://pypi.hustunique.com
6、山东理工大学:http://pypi.sdutlinux.org
全局镜像源配置,在PyCharm终端依次执行如下命令:
pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果不使用全局镜像源,可以执行如下命令单次使用镜像源下载第三方库:
pip install -i <镜像源地址> <第三方库名>