V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
geew
V2EX  ›  问与答

virtualenv 为啥会默认添加了系统的搜索路径呢??? 怎么解决呢

  •  
  •   geew · 2014-06-20 15:50:11 +08:00 · 2792 次点击
    这是一个创建于 3845 天前的主题,其中的信息可能已经有所发展或是发生改变。
    新的安装, 建立环境的时候也没有添加额外的参数啊, 但为啥它就是使用了系统的全局site-package呢??

    不解啊啊, 一遇到问题一波问题就来, 平时怎么用都没问题的啊啊, 为啥啊??

    跟python版本有关么, 服务器运行的是python2.6 centos64
    第 1 条附言  ·  2014-06-20 17:38:55 +08:00
    - 建立
    [xxx@localhost xxx]$ virtualenv-2.6 --no-site-packages menv2
    New python executable in menv2/bin/python
    Installing setuptools, pip...done.

    - 激活
    [xxx@localhost xxx]$ . menv2/bin/activate

    - 查看
    (menv2)[xxx@localhost xxx]$ python
    Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> sys.path
    ['', '/usr/lib/python2.6/site-packages/Jinja2-2.7.1-py2.6.egg', '/usr/lib/python2.6/site-packages/MySQL_python-1.2.4-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/pyOpenSSL-0.12-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/redis-2.8.0-py2.6.egg', '/usr/lib/python2.6/site-packages/Flask-0.10.1-py2.6.egg', '/usr/lib/python2.6/site-packages/pycurl-7.19.0.2-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/gunicorn-18.0-py2.6.egg', '/usr/lib/python2.6/site-packages/pika-0.9.13-py2.6.egg', '/usr/lib/python2.6/site-packages/tornado-1.2-py2.6.egg', '/usr/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg', '/usr/lib/python2.6/site-packages/Beaker-1.6.4-py2.6.egg', '/usr/lib/python2.6/site-packages/BeautifulSoup-3.2.1-py2.6.egg', '/usr/lib/python2.6/site-packages/Markdown-2.4.1-py2.6.egg', '/usr/lib/python2.6/site-packages/MarkupSafe-0.23-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/PyMySQL-0.5-py2.6.egg', '/usr/lib/python2.6/site-packages/chardet-2.2.1-py2.6.egg', '/usr/lib/python2.6/site-packages/requests-2.3.0-py2.6.egg', '/usr/lib/python2.6/site-packages/supervisor-3.0-py2.6.egg', '/usr/lib/python2.6/site-packages/meld3-1.0.0-py2.6.egg', '/usr/lib/python2.6/site-packages/psycopg2-2.5.3-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/torndb-0.2-py2.6.egg', '/usr/lib/python2.6/site-packages/wtforms_tornado-0.0.1-py2.6.egg', '/usr/lib/python2.6/site-packages/WTForms-2.0-py2.6.egg', '/usr/lib/python2.6/site-packages/ordereddict-1.1-py2.6.egg', '/data/xxx', '/data/Python/xxx',]


    疯了
    2 条回复    2014-06-20 17:28:48 +08:00
    glasslion
        1
    glasslion  
       2014-06-20 16:00:06 +08:00   ❤️ 1
    给 virtualenv 低于 1.7 的要手动加 --no-site-packages 参数
    geew
        2
    geew  
    OP
       2014-06-20 17:28:48 +08:00
    @glasslion 加了还是不对啊 还是把系统的加进来了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2774 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 14:33 · PVG 22:33 · LAX 06:33 · JFK 09:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.