博客
关于我
python安装包的离线安装方法
阅读量:141 次
发布时间:2019-02-26

本文共 809 字,大约阅读时间需要 2 分钟。

说明:Python的离线安装可能因模块间依赖包众多而容易出错,而在线安装仅需执行“pip install 包名”便能自动安装依赖,通常无需担心安装问题。

Linux安装

Linux版本常见后缀为".whl"和".tar.gz",可通过以下方式查找相关包:

https://pypi.org/

Windows安装

Windows版本的常见后缀为".whl",可直接查找相关包:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

以".whl"文件为例的离线安装方法

以NumPy为例:

在Linux中安装(默认文件在当前目录):pip install numpy-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl

在Windows中安装(默认文件在当前目录):pip install numpy-1.14.5+mkl-cp27-cp27m-win_amd64.whl

以".tar.gz"文件为例的离线安装方法

(1) 解压文件:

对于".tar.gz"文件:tar -xzvf numpy-1.15.0.tar.gz

对于".zip"文件:unzip numpy-1.15.0.zip

(2)进入目录:"numpy-1.15.0":

cd numpy-1.15.0

(3)安装:运行setup.py命令:

python setup.py install

个人建议

(1)推荐使用".whl"文件安装,避免".tar.gz"安装可能带来的编译错误风险。

(2)注意".whl"文件编码方式:cp27-cp27mu文件每字节占用4个字符,相比cp27-cp27m文件的2个字符更稳定,建议优先安装cp27-cp27mu文件。

原文:https://blog.csdn.net/make_progress/article/details/81636168

你可能感兴趣的文章
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
no session found for current thread
查看>>