1、修改pip源

临时使用: 
可以在使用pip的时候在后面加上-i参数,指定pip源 
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

常用的源有:

新版ubuntu要求使用https源,要注意。

# 清华源
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn # 阿里云源
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com ## 以下设置trusted-host也类似
# 中国科技大学
https://pypi.mirrors.ustc.edu.cn/simple/
# 华中理工大学:
http://pypi.hustunique.com/
# 山东理工大学:
http://pypi.sdutlinux.org/
# 豆瓣:
http://pypi.douban.com/simple/

永久修改:

linux: 
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下(以清华源为例):

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host= pypi.tuna.tsinghua.edu.cn

windows:

(1)在windows文件管理器中,输入 %APPDATA%

(2)在该目录下新建pip文件夹,然后到pip文件夹里面去新建个pip.ini文件

(3)在新建的pip.ini文件中输入以下内容(以阿里云源为例):

阿里云的源:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

离线下载网站:https://pypi.python.org/pypi(centos,windows),https://www.lfd.uci.edu/~gohlke/pythonlibs(windows)

six:pip install six

离线版:six-1.11.0-py2.py3-none-any.whl(centos版),six-1.11.0-py2.py3-none-any.whl(windows版),后面类似

pytz:pip install pytz

离线版:pytz-2017.3-py2.py3-none-any.whl,pytz-2017.3-py2.py3-none-any.whl

pillow:pip install pillow(自动安装olefile, pillow)

离线版:Pillow-4.3.0-cp27-cp27mu-manylinux1_x86_64.whl,Pillow-4.3.0-cp27-cp27m-win_amd64.whl

numpy:pip install numpy

离线版:numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl,numpy-1.13.3-cp27-none-win_amd64.whl

decorator:pip install decorator

离线版:decorator-4.1.2-py2.py3-none-any.whl,decorator-4.1.2-py2.py3-none-any.whl

pyparsing:pip install pyparsing

离线版:pyparsing-2.2.0-py2.py3-none-any.whl,pyparsing-2.2.0-py2.py3-none-any.whl

scikit-learn:pip install scikit-learn

离线版:scikit_learn-0.19.1-cp27-cp27mu-manylinux1_x86_64.whl,scikit_learn-0.19.1-cp27-cp27m-win_amd64.whl

backports.functools-lru-cache:pip install backports.functools-lru-cache

离线版:backports.functools_lru_cache-1.4-py2.py3-none-any.whl,backports.functools_lru_cache-1.4-py2.py3-none-any.whl

cycler:pip install cycler(自动安装six,cycler)

离线版:cycler-0.10.0-py2.py3-none-any.whl,cycler-0.10.0-py2.py3-none-any.whl

python-dateutil:pip install python_dateutil(自动安装six,python_dateutil)

离线版:python_dateutil-2.6.1-py2.py3-none-any.whl,python_dateutil-2.6.1-py2.py3-none-any.whl

scipy:pip install scipy(自动安装numpy, scipy)

离线版:scipy-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl,scipy-1.0.0-cp27-none-win_amd64.whl

PyWavelets:pip install PyWavelets(自动安装numpy,PyWavelets)

离线版:PyWavelets-0.5.2-cp27-cp27mu-manylinux1_x86_64.whl,PyWavelets-0.5.2-cp27-none-win_amd64.whl

pandas:pip install pandas(自动安装six, python-dateutil, numpy, pytz, pandas)

离线版:pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl,pandas-0.21.0-cp27-cp27m-win_amd64.whl

matplotlib:pip install matplotlib(自动安装pyparsing, backports.functools-lru-cache, six, python-dateutil, subprocess32, pytz, cycler, numpy, matplotlib)

离线版:matplotlib-2.1.0-cp27-cp27mu-manylinux1_x86_64.whl,matplotlib-2.1.0-cp27-cp27m-win_amd64.whl

skimage:pip install scikit-image(自动安装numpy, PyWavelets, scipy, decorator, networkx, six, pyparsing, backports.functools-lru-cache, python-dateutil, subprocess32, pytz, cycler, matplotlib, olefile, pillow, scikit-image)

离线版:scikit_image-0.13.1-cp27-cp27mu-manylinux1_x86_64.whl,scikit-image-0.13.1.tar.gz

可能遇见的问题

1、(安装skimage时)skimage\external\tifffile\tifffile.c(75) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory

原因: stdint.h是c99标准的头文件,vc不支持,所以出现错误“No such file or directory”。

解决方法: 
①去我的资源中下载msinttypes-r26.zip,地址为:http://download.csdn.net/detail/atfuies/9887776解压后得到3个文件:inttypes.h,stdint.h,changelog.txt 
②找到VC的include目录,一般默认的VC for Python 的include位置为: 
C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include 
有的用户名不是Administrator,将Administrator替换为你自己的用户名。 
③将inttypes.h和stdint.h两个文件放到VC for Python 的include文件中。

2、(pip install scikit-image时)error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

原因:python通过pip或者源码来安装某些模块时,这些模块包含有c/c++源码,安装过程会调用本地的编译器编译这些代码。

由于Python默认调用VS2008编译器编译相关C代码,因此出现这种错误的原因可能有如下几个方面:

(1)没有安装VS2008

(2)安装了32位VS2008,使用64位python

解决方法:vs2008已经过时,直接指定更高版本的vs。先确保已安装vs(如vs2013,vs2015等)。

指定方法:打开 “python安装目录/Lib/distutils/msvc9compiler.py”文件,找到find_vcvarsall函数,在该函数开头添加version =VS版本号(最好用pycharm编辑,文本编辑器容易出现空格,tab等造成的格式对齐问题),例如使用VS2013,则version = 12.0。

python包安装-centos7/windows的更多相关文章

  1. python包安装

    python包安装: 一种是有网操作:pip install  包名:例子[pip install setuptools] 无网络服务器上操作: 先把包下载:传上去再安装[] 1.一种是   *.wh ...

  2. Java Service Wrapper将jar包安装成Windows服务

    刚接触java,第一次使用Java开发windows服务,也是刚不久看了SSM框架 简直也是一头雾水,不过只要用心理解,其实很简单,下面有详细的步骤,包学包会 在windows上运行jar包,需要在工 ...

  3. vs中python包安装教程

    vs安装python很简单,只需要在vs安装包中选择python就可以了,这里使用的python3.7: 如果有了解,都知道安装python包的指令:"pip install xxx&quo ...

  4. Python包安装及使用指南

    这里长期更新一些Python第三方包的安装教程,以及使用教程... Pygame 安装教程: Windows: 首先,查看已安装的Python版本:访问https://www.lfd.uci.edu/ ...

  5. python包安装和使用机制

    python语言的魅力之一就是大量的外置数据包,能够帮助使用者节省很多时间,提高效率.模块下载和引用是最常见的操作,现在解析内部的原理和背后发生的故事,做到心里有数. 导航: 基本定义 模块使用 模块 ...

  6. Python解释器安装问题-windows

    问题一-更新问题(update your machine) 解决方案 1 搜索 windows update 2 检查更新 3 安装更新重启 问题二-0x80072efd错误 问题原因: 安装包需要在 ...

  7. Python包安装过程

    以下是paramiko-1.7.7.1的安装过程,可以看到整个过程分为步,第一步是build,就是拷贝源文件到build文件夹里, F:\VMFiles\tmpFiles\paramiko-1.7.7 ...

  8. 用pip命令把python包安装到指定目录

    sudo pip install transforms3d --target=/usr/local/lib/python2.7/site-packages pip install transforms ...

  9. python 包 安装 加速 pip anaconda

    使用 -i 参数指定源,豆瓣的很快: pip install web.py -i http://pypi.douban.com/simple anaconda: ~/.condarc channels ...

随机推荐

  1. bzoj 2428: [HAOI2006]均分数据 && bzoj 3680 : 吊打XXX 模拟退火

    每次把元素随便扔随机一个初始解,退火时每次随机拿一个元素扔到随机一个集合里,当温度高时因为状态不稳定扔到那个元素和最小的里边. 如果新解优,更新ans. 把原式拆一下,就可以用int存了. bzoj ...

  2. 【纪中集训2019.3.13】fft

    题意: 描述 一共有\(n+m\)道题,其中\(n\)道答案是\(A\),\(m\)道答案是\(B\): 你事先知道\(n和m\),问在最优情况下的期望答错次数,对\(998244353\)取模: 范 ...

  3. Python之旅:入门

    一 编程与编程语言 python是一门编程语言,作为学习python的开始,需要事先搞明白:编程的目的是什么?什么是编程语言?什么是编程? 编程的目的: #计算机的发明,是为了用机器取代/解放人力,而 ...

  4. Web前端之Javascript详解20180330

    一.javascript概述 javascript是基于对象和事件的脚本语言. 特点: 1.安全性(不允许直接访问本地硬盘(因为是被远程的浏览器解释)),它可以做的就是信息的动态交互 2.跨平台性(只 ...

  5. php static 变量用法

    有时候我们可能需要重复调用一个函数,里面有些变量不需要重复初始化.初始化成本比较高的,我们可以使用 static 关键字修饰,在该变量没有初始化的时候才进行初始化,初始化过的变量就不再初始化.如: f ...

  6. python安装pip、numpy、scipy、statsmodels、pandas、matplotlib等

    1.安装python 2.安装numpy(开源的数值计算扩展,可用来存储和处理大型矩阵,比Python自身的嵌套列表(nested list structure)结构要高效的多. 很多库都是以此库为依 ...

  7. 【Asp.net入门4-01】基本开发工具

  8. 一个最简单的使用Entity Framework 查询SQL 数据库的例子

    1.ADO.NET 3.5 Entity Framework是随着.net framework 3.5一起发布的,确认开发环境版本是大于等于3.5版本 2.确认已经安装了ADO.NET 3.5 Ent ...

  9. Python【logging】模块

    # 1.负责往控制台里面输出日志信息的 # 2.往日志文件里面写日志的,按天生成日志,清理日志 import logging from logging import handlers logger = ...

  10. 科学计算三维可视化---Traits属性的功能

    Traits属性的功能 Traits库为python的属性增加了类型定义的功能,除此之外他还提供了5个特殊的功能(可以为用户的界面响应提供基本能力):初始化:每个traits属性都有自己的默认值验证: ...