点子包路径-Windows [英] Pip packages path - windows
问题描述
我已经pip install <package name>
将软件包安装到AppData/Python/Python36/Scripts文件夹中.如何从命令行知道此文件夹的确切路径?
I have pip install <package name>
installing the packages to AppData/Python/Python36/Scripts folder. How do I know the exact path to this folder from Command line?
我尝试做py -m site --userbase
这显示了不存在的AppData/Roaming/Python/Python36.在不实际进行手动搜索的情况下,如何知道路径?
I tried doing py -m site --userbase
This is showing AppData/Roaming/Python/Python36 which does not exist. How will I get to know the path without actually doing manual search?
PS:我正在编写一个自动化脚本,以稍后安装pip和awscli.安装pip后,我遇到未找到命令的错误.因此,寻找如何直接从脚本设置路径,而不必面对手动设置路径的问题.发现pip.exe和aws.exe在AppData/Python/Python36/Scripts下.我的问题是如何从脚本内部获取此路径.
PS : I am writing an automation script to install pip and awscli later. After I install pip, I face command not found error. So looking how to set path directly from a script without having to face the issue of manually setting it. Found out that pip.exe and aws.exe are under AppData/Python/Python36/Scripts. My question is how do I get this path from inside a script.
推荐答案
以下是获取请求结果的方法:
Here's how to obtain the requested result:
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
这篇关于点子包路径-Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!