总结pip安装python包常用方式

-  普通安装  

    pip install package

-  去缓存安装

    pip install --no-cache-dir packagename  

   "--no-cache-dir              Disable the cache."

    去缓存安装的目的,保证你更新代码时,不能将新的代码安装进去

-  国内源安装  

    国内源 自行百度  

    本次使用清华源安装  

    pip  --default-timeout=1000 install --no-cache-dir packagename -i https://pypi.tuna.tsinghua.edu.cn/simple

--default-timeout=1000 设置超时时间 默认时长是15s 这此设置 1000s

-  从搭建的私有源安装

    pip3 install --no-cache-dir packagename -i 服务地址 --trusted-host 服务地址中的ip

    服务地址类似: https://pypi.tuna.tsinghua.edu.cn/simple 这个是清华源

-  指定依赖环境文件安装    

    pip  install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt 

-  指定依赖环境,并指定私有源

    pip  install --no-cache-dir -i 服务地址 -r requirements.txt --trusted-host 服务地址中的ip

-  指定以来环境文件及指定离线安装包  

    pip install -r requirements.txt --no-index --find-links 离线安装包路径

发布了157 篇原创文章 · 获赞 85 · 访问量 34万+

猜你喜欢

转载自blog.csdn.net/Areigninhell/article/details/102582235
今日推荐