我是 mac 用户,用来运行 pip install--user
,但最近之后brew update
,我发现有一些奇怪的事情,也许是相关的。
无论我尝试什么,软件包总是安装到~/Library/Python/2.7/lib/python/site-packages
这是我运行的命令。
$ 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
那么应该是什么问题呢?
我用于 lambda 拉链包装
Updates:
如果使用 Mac OS X 并且您使用 Homebrew 安装了 Python(请参阅 Homebrew),则接受的命令将不起作用。一个简单的解决方法是添加一个setup.cfg
文件在你的/path/to/project-dir
包含以下内容。
[install]
prefix=
https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
您可以使用target (t) flag https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-t of pip install
指定安装的目标位置。
In use:
pip install -r requirements.txt -t /path/to/directory
到当前目录:
pip install -r requirements.txt -t .
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)