一唉擂、how does Python know where to find packages when you call import?
- 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國(guó)內(nèi)鏡像源配置
手動(dòng)指定:pip -i http://pypi.douban.com/simple install dnspython
或者創(chuàng)建$HOME/.pip/pip.conf修改pip配置
[global]
trusted-host = mirrors.ustc.edu.cn
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
四队丝、修改pip安裝路徑
手動(dòng)指定:pip -t HOME/.pip/pip.conf修改pip配置 install sixHOME/.pip/pip.conf修改pip配置
target=$HOME/.pip/pip.conf修改pip配置