pipenv安装库使用国内镜像

pipenv install django超级慢,卡住不动,最后不得不CTRL+C中止

时有必要改成国内源了,打开Pipfile文件,发现内容是:

[[source]] verify_ssl = true name = "pypi" url = "https://pypi.org/simple" [packages] [dev-packages] [requires] python_version = "3.4"

把url替换成阿里云源(这里国内源的选择问题可以参考我上篇文章:《pip使用国内镜像解决安装超时):http://mirrors.aliyun.com/pypi/simple/     

运行发现有出现不信任的问题了

索性将url改成url = "http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com"

[[source]] verify_ssl = true name = "pypi" url = "http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com" [packages] [dev-packages] [requires] python_version = "3.4"

再次安装,显示:

这个问题是由于django需要python版本大于等于3.5,我的是3.4.4,版本不匹配导致,换requests库试试:pipenv install requests

可以看到,只花了3s,速度感人,有人说,清华源更好用,豆瓣源不好用,还没尝试

需要注意的是,这时候Profile文件中的[packages]下,多了requests = "*",标识了本项目依赖于requests

[[source]] verify_ssl = true name = "pypi" url = "http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com" [packages] requests = "*" [dev-packages] [requires] python_version = "3.4"

同时安装过程中有句话叫做 Updated Pipfile.lock,这时我们可以发现项目路径下又生成了一个 Pipfile.lock 文件,内容如下:

{ "_meta": { "hash": { "sha256": "2520a3c6b3ead035956ec3f7f1a9ebeb0c274f4e1568f752dcfd4d6538193c52" }, "pipfile-spec": 6, "requires": { "python_version": "3.4" }, "sources": [ { "name": "pypi", "url": "http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com", "verify_ssl": true } ] }, "default": { "certifi": { "hashes": [ "sha256:376690d6f16d32f9d1fe8932551d80b23e9d393a8578c5633a2ed39a64861638", "sha256:456048c7e371c089d0a77a5212fb37a2c2dce1e24146e3b7e0261736aaeaa22a" ], "version": "==2018.8.24" }, "chardet": { "hashes": [ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" ], "version": "==3.0.4" }, "idna": { "hashes": [ "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" ], "version": "==2.7" }, "requests": { "hashes": [ "sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1", "sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a" ], "index": "pypi", "version": "==2.19.1" }, "urllib3": { "hashes": [ "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf", "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5" ], "markers": "python_version != '3.2.*' and python_version < '4' and python_version != '3.1.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version >= '2.6'", "version": "==1.23" } }, "develop": {} }

可以看到里面标识了 Python 环境基本信息,以及依赖包的版本及 hashes 值

 

 

1|0参考文章


https://blog.csdn.net/jpch89/article/details/81952416

https://cuiqingcai.com/5846.html

 


__EOF__

本文作者cnhkzyy
本文链接https://www.cnblogs.com/my_captain/p/9589343.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   cnhkzyy  阅读(5745)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示