简体   繁体   中英

How do I make pip install binaries to a writable path?

I have python 2.7 installed through homebrew and running pip install -r requirements.txt on a project's requirements file. The packages download, everything goes fine until it's time to link the binaries - then Pip tries to put the binaries for f2py (a dependency of a package in the requirements.txt file) into /bin and I'm left with this error:

IOError: [Errno 1] Operation not permitted: '/bin/f2py'

I don't have root access so I'd like for pip to put all binaries in /usr/local/bin instead. How do I tell pip to install binaries into that directory?

I'd create a virtualenv (install it with pip first), then use the virtualenv to install all your requirements. That way you both have a writable path and keep your global Python installation clean for other projects.

Alternatively, you could use the --user option to install in the site.USER_SITE location:

pip install --local virtualenv

or

pip install --local -r requirements.txt

See the User Installs section in the documentation.

If you downloaded the package you can do

python setup.py install --user

pip now supports this behaviour by passing user to setup.py

pip install --user somepackage

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