I would like to use for a small Python project this way of managing dependent modules: http://blog.zoomeranalytics.com/pip-install-t/
In brief, I would do:
cd myproject
pip install --target ./pip-libs --upgrade -r requirements.txt
then add ./pip-libs to PYTHONPATH and run my script.
This seems but I like to use use pip freeze and it does not allow me to do anything like
pip freeze --target pip-libs
to see packages installed in the folder. Of course, I can take a look inside but what is a standard way to show packages installed in a folder with --target? The only way I can think of is doing ls
of pip-libs and then playing with grep, awk... Does not seem right.
I am not sure if there is a way, maybe it's not a good idea or I should request such functionality for pip.
Python 2.7.9.
聚会有点晚了,但我遇到了同样的问题,这似乎解决了它。
pip freeze --path ./pip-libs > requirements.txt
Unfortunatly, you cant do it with pip freeze
. The docs say that pip install
installs into that target folder, but its still within your path. So pip freeze
only shows what packages are installed, not what are installed in a particular place.
You could look at pip show
which does contain information on where they are installed (see https://pip.pypa.io/en/stable/reference/pip_show/ ) but you would have to write some sed/awk or similar to do a grep on the line "Location" and then go back and get the package name.
The other option is to just look at the folders in the install folder and manually work out what the packages where from that... something like:
ls ./pip-libs | grep -v .dist-info
这应该工作
PYTHONPATH=./pip-libs pip freeze
pip freeze --path [path location]
对于当前文件夹:
pip freeze --path .
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.