![](https://upload-images.jianshu.io/upload_images/24396273-c30e28ce01a3e2b7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) > 初次接触Python,是否不知道如何学?都说Python语言简单,简单在哪? 下面从一个懵懂无知的Python小白来安装一系列工作的记录,让完全不懂的小白也可上手安装,并且完成第一个Hello world代码。 ## 【Python 安装】 > 目前,Python有两个版本,一个是2.x版,一个是3.x版,这两个版本是不兼容的。由于3.x版越来越普及,我们的教程将以最新的Python 3.10版本为基础。 **进入Python的官方下载页面** http://www.python.org/download/ ![](https://upload-images.jianshu.io/upload_images/24396273-39ecc7390e31a7bc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 出现很多版本的,我们选择最新的版本3.10.4 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-f891893b07dfcdc1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 下载完成后点击运行,会出现安装界面,记得勾上步骤一! ![image.png](https://upload-images.jianshu.io/upload_images/24396273-04298a007a1f9b55.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-0b57c7d84708d59c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 出现这个就安装成功了 安装成功后,打开命令提示符窗口(win+R,在输入cmd回车),敲入python后,会出现两种情况: 情况一: ![image.png](https://upload-images.jianshu.io/upload_images/24396273-ea166a0abf68edbc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 出现这个表示python安装成功。 这个提示符 >>> 表示我们已经在Python编译环境中,可以输入Python代码,回车后会立刻得到执行结果。 输入exit()回车,就可以退出Python编译环境(或直接关掉命令行窗口也可以)。 情况 二: ![image.png](https://upload-images.jianshu.io/upload_images/24396273-80045226620cac42.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ## 【Python配置环境变量】 **右键此电脑–>选择属性–>选择高级系统设置–>选择环境变量** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-f6854ff84f983a40.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-bf0047f7b5dbda86.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-f322d1c32dbcc02b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **win+R ,输入cmd 回车** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-00b79b30a5a6fd3e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **输入python回车,进入python开发环境** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-87de774659608e88.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **打印“Hello world”** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-37ba1a1185498352.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 有的同学可能会在想 这个和我看到的编码怎么不一样? ![image.png](https://upload-images.jianshu.io/upload_images/24396273-b52358ae9c390347.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ## 【开发工具PyCharm】 *命令提示符和开发工具PyCharm对比* ![image.png](https://upload-images.jianshu.io/upload_images/24396273-f77eaf554014abcd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-b9599843edf14397.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 百度搜【[PyCharm官网 Download](https://www.jetbrains.com/pycharm/download/#section=windows)】 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-dd438c5a02deebe0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **下载那个版本自己决定,没人能左右你的选择,我用的专业版后面留有注册码!安装步骤看图操作:** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-852288f4527d22ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-2c253c8a0de75cc3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-4a12888873c13775.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 到此Pycharm就安装成功,接下来创建项目编写代码! **Pycharm永久激活步骤:** Help–>Register–>Activate PyCharm–>Activation code Pycharm注册码:**https://pan.baidu.com/s/1oRYRok3-PTBi78x5G3JsoQ** *提取码:8888* ![image.png](https://upload-images.jianshu.io/upload_images/24396273-8e8e9584d53ab531.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-babc8b33b161d3a2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-0fdd266453585888.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-be1fdd53d75e747b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-9f513d688713d2a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-e595597ec3d4d801.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-539786642155c7e7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ## 【PyCharm的插件】 . **打开File->Settings… 会跳出窗口** ![image.png](https://upload-images.jianshu.io/upload_images/24396273-733bf73810367dd3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 下载完**重启** 汉化 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-deb134e678e9fd98.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **个人建议不要汉化使用!** ## 【 pip的使用 】 假设我要安装Selenium Selenium 的安装很简单,可采用如下方式。 > pip install selenium **pip换源** win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件, 内容如下 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-84f104f32f3c3ebd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **列举几个常见的国内的pip源** > 阿里云:https://mirrors.aliyun.com/pypi/simple/ > 清华:https://pypi.tuna.tsinghua.edu.cn/simple 中国科技大学 > https://pypi.mirrors.ustc.edu.cn/simple/ > 华中理工大学:http://pypi.hustunique.com/ 山东理工大学:http://pypi.sdutlinux.org/ > 豆瓣:http://pypi.douban.com/simple/ Selenium安装好之后,python并不能直接使用,它需要与浏览器进行对接。这里拿Chrome浏览器为例。若想使用Selenium成功调用Chrome浏览器完成相应的操作,需要通过ChromeDriver来驱动。 链接:http://npm.taobao.org/mirrors/chromedriver/ https://chromedriver.storage.googleapis.com/index.html (版本要和谷歌版本一样) 我的是102.0.5005.13版本那你就要去下载这个版本 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-0fd8342c0bb7c769.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-6a7c641696091a0c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-13fd2392fe0f759b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 下载完成后,解压并且复制到Chrome和python环境的根目录 文件夹下 ![image.png](https://upload-images.jianshu.io/upload_images/24396273-b27d09afe069908e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-46fc44318d5963a0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](https://upload-images.jianshu.io/upload_images/24396273-9019d05311b3f05e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) [学Python从哪开始?(入门~精通:实战案例手把手教学)](https://www.bilibili.com/video/BV1WY411A7yb?p=1)