1.如果在有网的时候,大家可以这样安装所需要的modules:
pip install ***
2.但是很多公司内部局域网是不连接外网的,就需要在有网的机器上先下载所需要的python包,然后在去没网的机器上安装上:
有网的机器
- 先在D盘里创建一个空的文件夹newFolder
- 在文件夹下生成requirements.txt文件
pip freeze >requirements.txt
- 下载指定的包在新创建的文件夹目录
pip install --download d:\newFolder pandas -r requirements.txt
无网的机器
- 将下载好的python依赖包和requirements.txt导入进离线服务器,安装:
pip install --no-index --find-links=d:\newFolder\ pandas -r requirements.txt
3. 如果你知道自己缺什么包依赖包,比如当python报错,“No module named XXX”,只需要在百度上搜 “XXX PyPI”,下载相应的版本依赖就好了。
-
tar类的包,可CMD命令行到相应包的目录下,执行:
python set.up install
-
whl类的文件,可CMD命令行到相应的目录下,执行:pip install * (例如:
pip install Django-1.11.11-py2-py3-none-any.whl
)
参考:https://www.cnblogs.com/noube/p/9070672.html
https://www.cnblogs.com/michael-xiang/p/5690746.html