简体   繁体   中英

The installation directory of pip

On Mac OS X, I've had the packages directory of /Library/Python/2.7/site-packages . However, after installing 64 bit Python from brew ( Executing python in 64 bit mode on Mac OS X 10.10 ), I find that pip install installs the package into a new /usr/local/lib/python2.7/site-packages directory.

How can I control the target directory where the pip command installs the packages? I can I make the default target directory for pip from one to another?

You can, at least by calling the right pip . Thus, if you install pip through the base OS X Python ( /usr/bin/easy_install pip , I would guess), then this pip ( /usr/bin/pip , I would guess) will install new packages in the base OS X Python library ( /Library/Python/… ).

Now, you would normally not want to do this, and instead completely move to whatever Python you want to use (that would be brew's, in your case). In fact, this makes things simpler, since you have a single version of Python to care about, where you can put all the packages you need.

I simply revert back to original with reinstallation of pip with sudo easy_install pip . This installs /usr/local/bin/pip .

I also checked that the /usr/local/Cellar/python/2.7.9/bin/pip is symbolically linked to (overwritten) /usr/local/bin/pip .

I aliased a command alias pip64='/usr/local/Cellar/python/2.7.9/bin/pip' so that the brew's python package installation is executed with pip64 whereas the normal case is with pip .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM