代码之家  ›  专栏  ›  技术社区  ›  Tristram Gräbener

virtualenv macosX--未忽略任何站点包

  •  2
  • Tristram Gräbener  · 技术社区  · 16 年前

    我对macOSX和virtualenv有问题。它似乎忽略了——没有站点包。 使用与linux(archlinux)完全相同的命令可以工作。它支持macOSX 10.5和Python2.5

    curl -o virtualenv.py 'http://bitbucket.org/ianb/virtualenv/raw/tip/virtualenv.py
    

    创造新环境

    python virtualenv.py --no-site-packages foo
    New python executable in foo/bin/python
    Installing setuptools...........................done.
    

    激活它

    source foo/bin/activate
    

    试着在里面装点东西。尽管virtualenv,它仍在寻找系统范围内的安装

    easy_install cherrypy
    Searching for cherrypy
    Best match: CherryPy 3.1.2
    Adding CherryPy 3.1.2 to easy-install.pth file
    
    Using /Library/Python/2.5/site-packages
    Processing dependencies for cherrypy
    Finished processing dependencies for cherrypy
    

    但它没有找到模块

    (foo)guidage-multimodal:~ tristram$ python
    Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
    [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cherrypy
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named cherrypy
    

    我在看了皮普的照片后试了试 virtualenv --no-site-packages and pip still finding global packages?

    更新 在MacOS10.6上,它按预期工作。可能是Python2.5旧了,或者安装坏了,所以我放弃了,需要MacOS10.6。。。

    1 回复  |  直到 9 年前
        1
  •  1
  •   Daniel    15 年前

    也有可能是easy\u安装版本太旧了。 我建议使用pip:

    easy_install pip
    pip install virtualenv -U
    virtualenv env
    source env/bin/activate
    pip -E env install cherrypy