Python修改默认包安装路径

python -m site
sys.path = [
    'C:\\Users\\li',
    'C:\\Python39\\python39.zip',
    'C:\\Python39\\DLLs',
    'C:\\Python39\\lib',
    'C:\\Python39',
    'C:\\Python39\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\li\\AppData\\Roaming\\Python'
USER_SITE: 'C:\\Users\\li\\AppData\\Roaming\\Python\\Python39\\site-packages'
ENABLE_USER_SITE: True

Edit C:\Python39\Lib\site.py
USER_SITE = "E:\\Python39_base"
USER_BASE = "E:\\Python39_site"

python -m site
sys.path = [
    'C:\\Users\\li',
    'C:\\Python39\\python39.zip',
    'C:\\Python39\\DLLs',
    'C:\\Python39\\lib',
    'C:\\Python39',
    'E:\\Python39_base',
    'C:\\Python39\\lib\\site-packages',
]
USER_BASE: 'E:\\Python39_site' (exists)
USER_SITE: 'E:\\Python39_base' (exists)
ENABLE_USER_SITE: True


发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

14 − 10 =