推荐学习书目
› 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
Akagi201
V2EX  ›  Python

Mac 上 python 的 site-packages 目录出现了两个?

  •  
  •   Akagi201 ·
    Akagi201 · May 3, 2015 · 5010 views
    This topic created in 4170 days ago, the information mentioned may be changed or developed.

    最近我的mac上pip install <something>需要用sudo. 以前是不需要的.
    最近动过virtualenv,pyenv跟pycharm.
    shell里面用python --version得到的结果是2.7.9也就是homebrew的.

    现在系统里有两个site-packages. 里面都有很多modules

    /usr/local/lib/python2.7/site-packages
    /Library/Python/2.7/site-packages
    

    因为pycharm上一些系统的包跳转需要使用/usr/bin/python做解释器才行. 所以当初动了一下.

    现在, 我要怎么做才能让pip不需要sudo, 新pip install的包装到homebrew的site-packages下面(/usr/local/lib/python2.7/site-packages)

    Supplement 1  ·  May 3, 2015
    用homebrew重装了python
    然后基本按照如下配置
    3 replies  •  2015-05-03 17:52:06 +08:00
    ericls
        1
    ericls  
       May 3, 2015
    一切都使用virtualenv
    arbipher
        2
    arbipher  
       May 3, 2015
    看不太懂,不过PyCharm可以在设置里面修改Project Interpreter,都统一到一个python好不好。

    P.S. 同意楼上不能更多,使用virtualenv
    Akagi201
        3
    Akagi201  
    OP
       May 3, 2015
    @ericls
    @arbipher

    是遇到点麻烦, 因为我也不知道原因, 所以我就描述了一些我做的事情.

    virtualenv有什么best practice吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2520 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:40 · PVG 22:40 · LAX 07:40 · JFK 10:40
    ♥ Do have faith in what you're doing.