文章目录
1 错误:ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问
解决方案:https://blog.51cto.com/u_15127610/4377532
安装:pip install <模块名> --user # 这里的 --user 照打就行了,别用自己的用户名
2 利用 .txt 文件批量安装包
pip install -r requirements.txt
文件中记录了包及版本信息
3 pip到指定虚拟环境中
参考:pip到指定虚拟环境中
先用 pip -V查看当前的pip来自哪里,若不是创建的虚拟环境,需要考虑重新设置 envs/your_virt_name/Lib/site.py 中路径信息
4 python pip install指定国内源镜像
pip install -i 国内镜像地址 包名
e.g. pip install -i http://mirrors.aliyun.com/pypi/simple numpy
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple