300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > streamlit包安装失败解决方法

streamlit包安装失败解决方法

时间:2019-04-02 22:42:07

相关推荐

streamlit包安装失败解决方法

因为需要给上层领导做一些算法的展示,因此接触到了streamlit这个包,在安装的时候重重失败,在这里记录一下安装历程

刚开始是直接用pip install streamlit 的方法安装,安装在自己已经创建好的一个虚拟环境,配置是python=3.6.13,结果根本无法获取包(可能是网的问题或者其他)

然后查了一下,借用了一些镜像网站进行安装,比如:

pip install 安装包名字 -i /simple/ --trusted-host //豆瓣镜像网站

pip install 安装包名字 -i /simple/ --trusted-host //豆瓣

pip install 安装包名字 -i https://pypi.tuna./simple/ --trusted-host pypi.tuna. //清华大学

pip install 安装包名字 -i /pypi/simple //阿里云

pip install 安装包名字 -ihttps://pypi.mirrors./simple //中国科技大学

pip install 安装包名字 -ihttp://pypi.mirrors./simple // 中国科学技术大学

上面这些都能够很快的获取到包,但是在安装的过程中,显示一个错误叫做

ModuleNotFoundError: No module named 'maturin'

没办法又把这个包独自安装了一下

pip install maturin

然后继续

pip install streamlit -i/simple/ --trusted-host

这次没有错误了,但是在包下载结束之后显示了一个错误:

Cannot uninstall 'pyzmq'. It is a distutils installed project and thus we cannot accurately determin

查了下是因为这个环境下已经有pyzmq这个包了,但是无法将其进行升级

为了不把环境搞乱,最终决定为streamlit独自创建一个新环境,之前看好像是python 3.8更加适配streamlit这个包,因此使用anaconda创建了一个新环境(这里需要电脑已经按照anaconda)

在左下角搜索框输入cmd,然后启动命令行,在命令行里面输入:

conda create -n env-name python=3.8

在env-name处输入你的环境名字,为了方便区分我是直接输入的:

conda create -n streamlit python=3.8

然后打开anaconda prompt(cmd打开命令行也行),输入:

activate streamlit

然后直接输入:

pip install streamlit --default-timeout=100 -i https://pypi.tuna./simple

这里 --default-timeout=100是因为之前有一次安装提示超时所以多了这一步

然后就成功了,因为新环境没有很多多余的包,也不至于把以前的环境搞乱

最后输入

streamlit hello

显示:

至此,长达三个小时与streamlit的斗争结束了

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。