【问题标题】:where does django install in ubuntudjango 在 ubuntu 中安装在哪里
【发布时间】:2009-07-08 01:38:33
【问题描述】:

我正在寻找 django 的 init.py 文件。我尝试了 whereis 和 find,但我得到了很多目录。

【问题讨论】:

    标签: python django ubuntu


    【解决方案1】:

    你可以打印出来。

    >>> import django
    >>> print django.__file__
    /var/lib/python-support/python2.5/django/__init__.pyc
    >>>
    

    或:

    import inspect
    import django
    print inspect.getabsfile(django)
    

    【讨论】:

    • 很棒的小费!对所有其他库非常有用
    【解决方案2】:

    当您在其他包中搜索文件时,这(或类似的东西)也适用:

    $ dpkg -L python-django | grep __init__.py
    

    【讨论】:

      【解决方案3】:

      现在在

      /usr/lib/python2.7/dist-packages/django/....
      

      大约在 2012 年

      【讨论】:

        【解决方案4】:

        一个单行命令(在django docs 中给出)来查找您的 django 源文件的位置:

        $ python -c "import django; print(django.__path__)"
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-12-10
          • 2011-07-15
          • 1970-01-01
          • 2011-11-04
          • 2014-09-01
          • 1970-01-01
          • 2011-10-25
          • 1970-01-01
          相关资源
          最近更新 更多