windows下更新pip和安装ipython过程中遇到的问题以及解决方法

之前安装pip和ipython的过程很顺利,从未出错,但是...

自从重装了win10的系统以后,安装pip和ipython就各种出错,可以说安装之路很坎坷...

下面说一下我遇到的问题和安装的方法:

因为我安装的python是2.7的


在用pip安装ipython的时候,

>pip install ipython

一直提示read time out苦大仇深的我就被逼无奈自行百度,研究之后发现换个国内的镜像源就好了。

在命令行输入

>echo %APPDATA%
得到 %APPDATA% 的路径为
C:\Users\XXX\AppData\Roaming

但是在AppData\Roaming里并没有pip文件夹,于是就在AppData\Roaming建一个pip文件夹,在pip文件夹里再建一个pip.ini文件,然后把下面的加到这个文件里就可以了。

[global]
index-url = http://pypi.douban.com/simple

配好之后输入下面的命令:

>pip install <包名> --trusted-host pypi.douban.com

下载安装包就会特别的快啦!

列几个国内的镜像源:

阿里云 速度最快 http://mirrors.aliyun.com/pypi/simple/ 
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

pip在安装python的时候就已经装好了,但是当时python装的是2.0版本的,在安装ipython的时候就提示让我更新pip到9.0。

根据提示

>python -m pip install --upgrade pip

更新pip还是一样的结果...

>python -m pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages
You are using pip version 8.1.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

因为前面配好了源,所以可以直接用

>pip install --upgrade pip --trusted-host pypi.douban.com

就可以成功升级了。

pip升级的问题解决了,是时候解决ipython安装的问题了...

C:\Users\CYCLE>pip install ipython
Collecting ipython
  The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pypi.douban.com'.
  Could not find a version that satisfies the requirement ipython (from versions: )
No matching distribution found for ipython

C:\Users\CYCLE>pip install ipython --trusted-host pypi.douban.com
Collecting ipython
  Downloading http://pypi.doubanio.com/packages/4f/a7/fc647e9ce711cd630873c37219c0bd4438b8171211d813c7e6b316811e02/ipython-6.3.1.tar.gz (5.1MB)
    100% |████████████████████████████████| 5.1MB 3.3MB/s
    Complete output from command python setup.py egg_info:

    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.

    See IPython `README.rst` file for more information:

        https://github.com/ipython/ipython/blob/master/README.rst

    Python sys.version_info(major=2, minor=7, micro=14, releaselevel='final', serial=0) detected.



    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\cycle\appdata\local\temp\pip-build-ctezzm\ipython\

提示说ipython 6.0+不支持python 2.6,2.7,3.0,3.1 ,3.2。我用的是python 2.7版本的,所以要安装对应的ipython 5.x版本..于是

>pip install ipython==5.6 --trusted-host pypi.douban.com

安装不同版本的ipython的时候要在ipython后面加版本号!!!例如:

>pip install ipython==版本号 --trusted-host 镜像源

提示

Successfully installed backports.shutil-get-terminal-size-1.0.0 colorama-0.3.9 decorator-4.2.1 enum34-1.1.6 ipython-5.6.0 ipython-genutils-0.2.0 pathlib2-2.3.0 pickleshare-0.7.4 prompt-toolkit-1.0.15 pygments-2.2.0 scandir-1.7 simplegeneric-0.8.1 six-1.11.0 traitlets-4.3.2 wcwidth-0.1.7 win-unicode-console-0.5

就安装成功了!!!


ipython的官方文档:http://ipython.readthedocs.io/en/stable/install/index.html


你可能感兴趣的:(python,windows,ipython)