推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Valyrian
V2EX  ›  Python

virtualenv (python2) 如何手动安装第三方 package?

  •  
  •   Valyrian ·
    pxia · Apr 18, 2015 · 3652 views
    This topic created in 4187 days ago, the information mentioned may be changed or developed.

    有这样一个python package(pip没有)
    en/
    __init__.py
    xxx.py
    xxx.py
    a/
    __init__.py
    xxx.py

    现在想在整个项目里随处可以这样调用
    import en
    from en import a

    该如何弄?直接copy到virtualenv的lib/似乎不行

    4 replies  •  2015-04-19 15:58:31 +08:00
    xierch
        1
    xierch  
       Apr 18, 2015
    把 en 目录放在其中一个 sys.path 下就行了
    messense
        2
    messense  
       Apr 18, 2015
    写好 setup.py 然后执行 python setup.py develop
    zjwzszh
        3
    zjwzszh  
       Apr 19, 2015
    放在虚拟环境的包路径里,你可以找下你已经装好的包的位置,然后丢进去试试
    zjwzszh
        4
    zjwzszh  
       Apr 19, 2015
    要是不行,就是驾到sys.path了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2258 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 103ms · UTC 11:01 · PVG 19:01 · LAX 04:01 · JFK 07:01
    ♥ Do have faith in what you're doing.