Offline Installation of python & pip

2019-02-10 21:46发布

I need to install python on a sever to run scripts but the server has no access to the internet.

The server has access to a local network that has access to the internet*. I would like to use pip to manage the packages through a local network directory as specified here.

How can I install pip, python and their dependancies on a windows machine, offline so that I can use pip, as specified in the link above to manage the packages I require?

*For Clarity: I have no ability to mirror, hack or otherwise to get information to pass through the local network directly from the internet.

1条回答
啃猪蹄的小仙女
2楼-- · 2019-02-10 22:28

The official Python installer for Windows has no other dependencies. It runs completely offline.

For other packages that may have dependencies (that are difficult to install on Windows); Christopher Gholke maintains a list of Windows installers for common Python packages. These are msi installers (or whl files) that are self-contained.

They are designed to work with the official Python installer for Windows - as they use its registry entries to identify the install location.

You can download these and move them to your Windows machine.

Beyond those two - if you have further requirements you can use tools like basket to download packages and then provide the location as a source for offline pip installs; or create your own pip repository.

If you do decide to create a local pip repository, it is better to create a pip proxy (see pypicache for example) this way you are only requesting those packages that are required, rather than trying to mirror the entire cheeseshop.

查看更多
登录 后发表回答