Python的安装
来源:互联网 发布:odn网络光功率全程衰 编辑:程序博客网 时间:2024/06/03 17:57
1.下载Python程序
首先访问http://www.python.org/download/去下载最新的python版本。
根据需要下载 python2 或者python3, 同时注意自己的操作系统版本是64位还是32位,选择符合自己的
这里介绍python2 的安装
2.安装下载包,一路next。
3.配置环境变量
右键计算机-->属性-->高级系统设置-->环境变量-->
在系统变量里面找到 Path, 然后将python 安装路径加入进去, 注意里面的分号是英文格式的 ‘;’
打开cmd 终端参照下面,如果能显示python 版本, python 就可以工作了
C:\>pythonPython 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> a = 'hello world'>>> print ahello world>>>
虽然至此python 能够工作了,但是还有一些其他的内容需要配置
我们使用python 的时候,难免要使用到一些第三方库,或者一些架构,因此需要先把工具准备好
4.1 pip 工具
首先 同样的配置环境变量
将python 目录下的Script 也加到环境变量中去
C:\Python27\Scripts
然后在命令行下执行pip
但是很遗憾, 系统提示如下:
C:\Python27>pip'pip' 不是内部或外部命令,也不是可运行的程序或批处理文件。
C:\Python27\Scripts>pip install bs4Collecting bs4 Using cached bs4-0.0.1.tar.gzCollecting beautifulsoup4 (from bs4) Using cached beautifulsoup4-4.5.3-py2-none-any.whlInstalling collected packages: beautifulsoup4, bs4 Running setup.py install for bs4Successfully installed beautifulsoup4-4.5.3 bs4-0.0.1You are using pip version 7.1.2, however version 9.0.1 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.
系统提示我们, pip 的版本太低了, 那我们升级一下pip 的版本
python -m pip install --upgrade pip
接着执行
pip install bs4实验一下是否安装成功
C:\Python27\Scripts>pythonPython 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import bs4>>>没有报错, 那就OK了
4.2 利用easy_install 安装 lxml
C:\Python27\Scripts>easy_install-2.7.exe lxmlSearching for lxmlReading https://pypi.python.org/simple/lxml/Best match: lxml 3.7.2Downloading https://pypi.python.org/packages/66/45/f11fc376f784c6f2e77ffc7a9d02374ff3ceb07ede8c56f918939409577c/lxml-3.7.2.tar.gz#md5=8dcf8d6c692Processing lxml-3.7.2.tar.gzWriting c:\windows\temp\easy_install-iudefp\lxml-3.7.2\setup.cfgRunning lxml-3.7.2\setup.py -q bdist_egg --dist-dir c:\windows\temp\easy_install-iudefp\lxml-3.7.2\egg-dist-tmp-4pweyfBuilding lxml version 3.7.2.Building without Cython.ERROR: 'xslt-config' 不是内部或外部命令,也不是可运行的程序或批处理文件。** make sure the development packages of libxml2 and libxslt are installed **Using build configuration of libxslterror: Setup script exited with error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27
报错提示我们需要安装 Microsoft Visual C++ 9.0
点击这里下载
安装下载好的 VCForPython27.msi 一路next 就好
同时也需要安装 pywin32
下载地址
安装下载好的pywin32一路next 就好
这些都安装好了之后,继续通过命令行安装lxml,但是可能会因为网速的原因,这种方式依然安装的很慢,那么我们只能通过直接下载安装包的方式来安装
lxml下载地址:点击 根据操作系统选择不同的版本(32位或者64位的)
安装下载好的lxml程序一路next 就好
安装scrapy
pip install scrapy
ImportError DLL load failed: %1 不是有效的 Win32 应用程序
是由于安装的32位的 MySQL-Python-1.2.3.win32-py2.exe,,只要改成64位版本的就可以了或者是你本身是64位的操作系统然后安装了32位的python
如果是 MySQL-Python安装错误,直接更改它的版本就行,如果是python 版本错误,那么需要重新安装上面的步骤
MySQL-Python可以使用如下链接下载:
32位:http://download.csdn.net/detail/seven_zhao/6607621
64位:http://download.csdn,net/detail/seven_zhao/6607625
也可以在如下地址下载:
http://www.codegood.com/downloads
- Python--day1 Python的安装
- Python 库的安装...
- Python--Setuptools的安装
- Python-- easy_install 的安装
- python的安装
- python工具的安装
- python BeautifulSoup的安装
- Windows-----Python的安装
- Python-- easy_install 的安装
- Python包的安装
- python Matplotlib的安装
- python 模块的安装
- Python的安装 - Windows
- python模块的安装
- Python-- easy_install 的安装
- python httplib2的安装
- python pip的安装
- python程序语言的安装
- MyBatis,动态传入表名,字段名的解决办法
- yii 框架 发送邮件
- 配置端口入站规则
- 算法学习(七)——排序总结
- 了解自动化制造业的光投影技术
- Python的安装
- c /c++复习笔记 第二天
- js的数组可以使用字符串作为下标,以及for...in
- ZCMU—1873
- Hello Quartz (第二部分)
- 【.Net码农】【Autofac】Ioc容器Autofac系列(1)-- 初窥
- 0216
- xprintf format string
- 集成微信SDK出现libc++abi.dylib: terminating with uncaught exception of type NSException,微信支付SDKDEMO运行编译报错