V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
rrfeng
V2EX  ›  Python

第一次迁移一个 Python 项目,先是发现 virtualenv 真不错,后又发现底下的一堆依赖还是要靠自己……

  •  
  •   rrfeng · 2013-09-17 08:53:19 +08:00 · 10106 次点击
    这是一个创建于 3872 天前的主题,其中的信息可能已经有所发展或是发生改变。
    大体情况是

    数年前……virtualenv 搭建的一个 pylons 程序,系统 rhel 5.4
    准备放到 rhel 6.4 的系统上

    新系统上 virtualenv + easy_install 之后,运行程序,开始提示两次『某某参数已不再被支持,忽略』
    后又提示数据库访问错误之类的

    开发的人不在
    easy_install 又不能滚回旧版本的软件包
    只好从原系统上拷贝了 site-packages ,然后启动程序说找不到某某库 libexpat/openssl/…… 等等无穷尽也


    泪流满面。
    14 条回复    1970-01-01 08:00:00 +08:00
    BOYPT
        1
    BOYPT  
       2013-09-17 08:56:49 +08:00
    让你们开发人员写好requirement.txt, pip install -r requirement.txt
    cxshun
        2
    cxshun  
       2013-09-17 08:57:06 +08:00
    python的版本啥的都不一样了吗?
    geew
        3
    geew  
       2013-09-17 08:58:56 +08:00
    用virtualenv配好site-packages, 打包到项目, 以后就一劳永逸拉
    lixm
        4
    lixm  
       2013-09-17 09:29:45 +08:00
    pip 啊
    itcook
        5
    itcook  
       2013-09-17 09:38:33 +08:00
    综合上面的:fabric + virtualenv + pip + requirement.txt 这样?
    rrfeng
        6
    rrfeng  
    OP
       2013-09-17 10:00:02 +08:00
    @BOYPT
    @cxshun
    @geew
    @lixm
    @itcook
    virtualenv 也可以添加其他软件包么?比如 openssl 里的 libssl 之类的?

    如果不能,那 virtualenv 就没法解决这个问题

    在系统里安装旧版本的 openssl 是不合适的
    loading
        7
    loading  
       2013-09-17 10:12:59 +08:00 via iPhone
    对于企业内网的服务器,只能打包啊,整死人
    sobigfish
        8
    sobigfish  
       2013-09-17 10:13:12 +08:00
    那就加个makefile ,fabric好像也能解决
    lijingyu68
        9
    lijingyu68  
       2013-09-17 10:34:39 +08:00
    第一次用python就知道有virtualenv并将其应用到项目中的感觉好幸福。
    rrfeng
        10
    rrfeng  
    OP
       2013-09-17 10:35:02 +08:00
    @sobigfish
    编译旧版 openssl 库文件?
    fabric 不是重点……不是嫌手动烦,因为只有一台机器也只有这么一个程序而已。

    现在要么重新改程序适应新版 python 包
    要么用旧版本的 python 程序包 + 系统依赖的库文件……
    bh3887
        11
    bh3887  
       2013-09-17 16:28:27 +08:00
    我一般换机器就整个项目的virtual env打包,没问题啊
    BOYPT
        12
    BOYPT  
       2013-09-18 00:11:47 +08:00
    @rrfeng pip包编译的。当然如果你系统里面缺开发库那就只能直接手动装了。
    keakon
        13
    keakon  
       2013-09-18 00:30:36 +08:00
    zc.buildout 就可以顶替 virtualenv + pip 了
    wuxqing
        14
    wuxqing  
       2013-09-18 08:23:14 +08:00
    zc.buildout +1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5372 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 05:52 · PVG 13:52 · LAX 22:52 · JFK 01:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.