python package manage

一、how does Python know where to find packages when you call import?

  1. use sys.path

二、How sys.path gets populated

As the docs explain, sys.path is populated using the current working directory, followed by directories listed in your PYTHONPATH environment variable, followed by installation-dependent default paths, which are controlled by the site module.

三、pip国内镜像源配置

手动指定:pip -i http://pypi.douban.com/simple install dnspython
或者创建$HOME/.pip/pip.conf修改pip配置

[global]
trusted-host = mirrors.ustc.edu.cn
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple

四、修改pip安装路径

手动指定:pip -t HOME/.pip/pip.conf修改pip配置 install sixHOME/.pip/pip.conf修改pip配置
target=$HOME/.pip/pip.conf修改pip配置

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容