I am mac user, used to run pip install with --user
, but recently after brew update
, I found there are some strange things, maybe related.
Whatever I tries, the packages are always installed to ~/Library/Python/2.7/lib/python/site-packages
Here are the commands I run.
$ python -m site --user-site
~/Library/Python/2.7/lib/python/site-packages
$ pip install --user -r requirements.txt
$ PYTHONUSERBASE=. pip install --user -r requirements.txt
So what should be the problem?
I used for lambda zip packaging
If using Mac OS X and you have Python installed using Homebrew (see Homebrew), the preceding command will not work. A simple workaround is to add a setup.cfg
file in your /path/to/project-dir with the following content.
[install]
prefix=
https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
pip install -e installs the source under the current working directory instead of under the environment directory #12.
CAUTION: Make sure you check option Add Python 3.5 to PATH . To change install location, click on Customize installation , then Next and enter C:\python35 (or another appropriate location) as the install location. If you didn�t check the Add Python 3.5 PATH option earlier, check Add Python to environment variables .
You can use the target (t
) flag of pip install
to specify a target location for installation.
In use:
pip install -r requirements.txt -t /path/to/directory
to the current directory:
pip install -r requirements.txt -t .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With