Home > Archives > Python 学习

Python 学习

Publish:

Background

  1. Windows 7 专业版
  2. 64位操作系统
  3. 内存8GB

Install

  1. install python-3.6.1-amd64.exe
  2. install dev tools pycharm-community-2017.1.4.exe
  3. install module request

     C:\Users\baoguo>py -m pip install requests
     Collecting requests
       Downloading requests-2.18.1-py2.py3-none-any.whl (88kB)
         100% |████████████████████████████████| 92kB 74kB/s
     Collecting idna<2.6,>=2.5 (from requests)
       Downloading idna-2.5-py2.py3-none-any.whl (55kB)
         100% |████████████████████████████████| 61kB 100kB/s
     Collecting urllib3<1.22,>=1.21.1 (from requests)
       Downloading urllib3-1.21.1-py2.py3-none-any.whl (131kB)
         100% |████████████████████████████████| 133kB 50kB/s
     Collecting chardet<3.1.0,>=3.0.2 (from requests)
       Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
         100% |████████████████████████████████| 143kB 41kB/s
     Collecting certifi>=2017.4.17 (from requests)
       Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
         100% |████████████████████████████████| 378kB 30kB/s
     Installing collected packages: idna, urllib3, chardet, certifi, requests
     Successfully installed certifi-2017.4.17 chardet-3.0.4 idna-2.5 requests-2.18.1 urllib3-1.21.1
    
     C:\Users\baoguo>python
     Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
     Type "help", "copyright", "credits" or "license" for more information.
     >>> import request
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ModuleNotFoundError: No module named 'request'
     >>> import requests    ------这里没有错,说明安装成功,并且引用成功
     >>>
    

切换阿里源

windows在C:\Users\用户名,即登陆的用户名文件下,建立文件夹pip,在文件夹中建立pip.ini,如C:\Users\baoguo\

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

    [install]
    trusted-host=mirrors.aliyun.com

下载包安装

因为系统默认下载的包,可能存在兼容或者32位系统或者64位系统的问题,所以,先下载具体安装包,然后手动安装,也是一个不错的选择。

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

py -m pip install –upgrade –no-deps –force-reinstall numpy-1.13.1-cp36-cp36m-win_amd64.whl

py -m pip install scipy-0.19.1-cp36-cp36m-win_amd64.whl

其他插件安装顺序

  1. py -m pip install requests
  2. py -m pip install numpy
  3. py -m pip install scipy
  4. py -m pip install matplotlib
  5. py -m pip install pandas
  6. py -m pip install sympy
  7. py -m pip install nose
  8. py -m pip install ipython
  9. py -m pip install jupyter
  10. py -m pip install pandas-datareader

参考

  1. How to use pip with python 3.4 on windows?
  2. pip使用阿里源

声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo