<bdo id='d5wdu'></bdo><ul id='d5wdu'></ul>

      <tfoot id='d5wdu'></tfoot>
    1. <small id='d5wdu'></small><noframes id='d5wdu'>

      1. <legend id='d5wdu'><style id='d5wdu'><dir id='d5wdu'><q id='d5wdu'></q></dir></style></legend>

        <i id='d5wdu'><tr id='d5wdu'><dt id='d5wdu'><q id='d5wdu'><span id='d5wdu'><b id='d5wdu'><form id='d5wdu'><ins id='d5wdu'></ins><ul id='d5wdu'></ul><sub id='d5wdu'></sub></form><legend id='d5wdu'></legend><bdo id='d5wdu'><pre id='d5wdu'><center id='d5wdu'></center></pre></bdo></b><th id='d5wdu'></th></span></q></dt></tr></i><div id='d5wdu'><tfoot id='d5wdu'></tfoot><dl id='d5wdu'><fieldset id='d5wdu'></fieldset></dl></div>
      2. 如何离线安装包?

        How to install packages offline?(如何离线安装包?)

      3. <small id='ElZ3O'></small><noframes id='ElZ3O'>

        <tfoot id='ElZ3O'></tfoot>
            <tbody id='ElZ3O'></tbody>
          <legend id='ElZ3O'><style id='ElZ3O'><dir id='ElZ3O'><q id='ElZ3O'></q></dir></style></legend>
              <bdo id='ElZ3O'></bdo><ul id='ElZ3O'></ul>

                1. <i id='ElZ3O'><tr id='ElZ3O'><dt id='ElZ3O'><q id='ElZ3O'><span id='ElZ3O'><b id='ElZ3O'><form id='ElZ3O'><ins id='ElZ3O'></ins><ul id='ElZ3O'></ul><sub id='ElZ3O'></sub></form><legend id='ElZ3O'></legend><bdo id='ElZ3O'><pre id='ElZ3O'><center id='ElZ3O'></center></pre></bdo></b><th id='ElZ3O'></th></span></q></dt></tr></i><div id='ElZ3O'><tfoot id='ElZ3O'></tfoot><dl id='ElZ3O'><fieldset id='ElZ3O'></fieldset></dl></div>

                2. 本文介绍了如何离线安装包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  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 easy_install? I'm trying to install the requests library on a FreeBSD box that is not connected to the internet.

                  解决方案

                  If the package is on PYPI, download it and its dependencies to some local directory. E.g.

                  $ mkdir /pypi && cd /pypi
                  $ ls -la
                    -rw-r--r--   1 pavel  staff   237954 Apr 19 11:31 Flask-WTF-0.6.tar.gz
                    -rw-r--r--   1 pavel  staff   389741 Feb 22 17:10 Jinja2-2.6.tar.gz
                    -rw-r--r--   1 pavel  staff    70305 Apr 11 00:28 MySQL-python-1.2.3.tar.gz
                    -rw-r--r--   1 pavel  staff  2597214 Apr 10 18:26 SQLAlchemy-0.7.6.tar.gz
                    -rw-r--r--   1 pavel  staff  1108056 Feb 22 17:10 Werkzeug-0.8.2.tar.gz
                    -rw-r--r--   1 pavel  staff   488207 Apr 10 18:26 boto-2.3.0.tar.gz
                    -rw-r--r--   1 pavel  staff   490192 Apr 16 12:00 flask-0.9-dev-2a6c80a.tar.gz
                  

                  Some packages may have to be archived into similar looking tarballs by hand. I do it a lot when I want a more recent (less stable) version of something. Some packages aren't on PYPI, so same applies to them.

                  Suppose you have a properly formed Python application in ~/src/myapp. ~/src/myapp/setup.py will have install_requires list that mentions one or more things that you have in your /pypi directory. Like so:

                    install_requires=[
                      'boto',
                      'Flask',
                      'Werkzeug',
                      # and so on
                  

                  If you want to be able to run your app with all the necessary dependencies while still hacking on it, you'll do something like this:

                  $ cd ~/src/myapp
                  $ python setup.py develop --always-unzip --allow-hosts=None --find-links=/pypi
                  

                  This way your app will be executed straight from your source directory. You can hack on things, and then rerun the app without rebuilding anything.

                  If you want to install your app and its dependencies into the current python environment, you'll do something like this:

                  $ cd ~/src/myapp
                  $ easy_install --always-unzip --allow-hosts=None --find-links=/pypi .
                  

                  In both cases, the build will fail if one or more dependencies aren't present in /pypi directory. It won't attempt to promiscuously install missing things from Internet.

                  I highly recommend to invoke setup.py develop ... and easy_install ... within an active virtual environment to avoid contaminating your global Python environment. It is (virtualenv that is) pretty much the way to go. Never install anything into global Python environment.

                  If the machine that you've built your app has same architecture as the machine on which you want to deploy it, you can simply tarball the entire virtual environment directory into which you easy_install-ed everything. Just before tarballing though, you must make the virtual environment directory relocatable (see --relocatable option). NOTE: the destination machine needs to have the same version of Python installed, and also any C-based dependencies your app may have must be preinstalled there too (e.g. say if you depend on PIL, then libpng, libjpeg, etc must be preinstalled).

                  这篇关于如何离线安装包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)
                3. <tfoot id='BGXRx'></tfoot>
                  <i id='BGXRx'><tr id='BGXRx'><dt id='BGXRx'><q id='BGXRx'><span id='BGXRx'><b id='BGXRx'><form id='BGXRx'><ins id='BGXRx'></ins><ul id='BGXRx'></ul><sub id='BGXRx'></sub></form><legend id='BGXRx'></legend><bdo id='BGXRx'><pre id='BGXRx'><center id='BGXRx'></center></pre></bdo></b><th id='BGXRx'></th></span></q></dt></tr></i><div id='BGXRx'><tfoot id='BGXRx'></tfoot><dl id='BGXRx'><fieldset id='BGXRx'></fieldset></dl></div>
                4. <small id='BGXRx'></small><noframes id='BGXRx'>

                    <bdo id='BGXRx'></bdo><ul id='BGXRx'></ul>

                    • <legend id='BGXRx'><style id='BGXRx'><dir id='BGXRx'><q id='BGXRx'></q></dir></style></legend>

                            <tbody id='BGXRx'></tbody>