How to install packages offline?

后端 未结 10 894
一个人的身影
一个人的身影 2020-11-22 00:38

What\'s the best way to download a python package and it\'s dependencies from pypi for offline installation on another machine? Is there any easy way to do this with pip or

10条回答
  •  长发绾君心
    2020-11-22 01:27

    Let me go through the process step by step:

    1. On a computer connected to the internet, create a folder.
       $ mkdir packages
       $ cd packages
    
    1. open up a command prompt or shell and execute the following command:

      Suppose the package you want is tensorflow

      $ pip download tensorflow

    2. Now, on the target computer, copy the packages folder and apply the following command

      $ cd packages
      $ pip install 'tensorflow-xyz.whl' --no-index --find-links '.'
    

    Note that the tensorflow-xyz.whl must be replaced by the original name of the required package.

提交回复
热议问题