1.python安装
下载官网链接:https://www.python.org/
具体下载安装教程链接:https://www.runoob.com/python/python-install.html
2.pip升级
python -m pip install pandas
…
You are using pip version 9.0.1, however version 20.1.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.
键入python -m pip install --upgrade pip ,报错
Collecting pip
Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
3% |█ | 40kB 1.4kB/s eta 0:16:01Exception:
Traceback (most recent call last):
File “C:\安装\Python36-32\lib\site-packages\pip_vendor\requests\packages\urllib3\response.py”, line 232, in _error_catcher
yield
File “C:\安装\Python36-32\lib\site-packages\pip_vendor\requests\packages\urllib3\response.py”, line 314, in read
data = self._fp.read(amt)
File “C:\安装\Python36-32\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 60, in read
data = self.__fp.read(amt)
File “C:\安装\Python36-32\Lib\http\client.py”, line 449, in read
n = self.readinto(b)
File “C:\安装\Python36-32\Lib\http\client.py”, line 493, in readinto
n = self.fp.readinto(b)
File “C:\安装\Python36-32\Lib\socket.py”, line 586, in readinto
return self._sock.recv_into(b)
File “C:\安装\Python36-32\Lib\ssl.py”, line 1009, in recv_into
return self.read(nbytes, buffer)
File “C:\安装\Python36-32\Lib\ssl.py”, line 871, in read
return self._sslobj.read(len, buffer)
File “C:\安装\Python36-32\Lib\ssl.py”, line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\安装\Python36-32\lib\site-packages\pip\basecommand.py”, line 215, in main
status = self.run(options, args)
File “C:\安装\Python36-32\lib\site-packages\pip\commands\install.py”, line 324, in run
requirement_set.prepare_files(finder)
File “C:\安装\Python36-32\lib\site-packages\pip\req\req_set.py”, line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File “C:\安装\Python36-32\lib\site-packages\pip\req\req_set.py”, line 620, in _prepare_file
session=self.session, hashes=hashes)
File “C:\安装\Python36-32\lib\site-packages\pip\download.py”, line 821, in unpack_url
hashes=hashes
File "C:\安装\Python36-32\lib\site-packages\pip\download.
原因:服务器超时
解决方法:1.用手机热点或者网线直连
2.python -m pip install --upgrade pip -i https://pypi.douban.com/simple (链接:https://www.cnblogs.com/karrya/p/10873075.html)
pip --version查看版本信息
安装库模块
python -m pip install pandas
python -m pip install pyinstaller
python -m pip install xlrd
python -m pip install xlwt
…
3.PyCharm快捷键
PyCharm安装:https://www.runoob.com/w3cnote/pycharm-windows-install.html
Ctrl + P 如果插入符号位于方法调用的括号之间,按Ctrl + P组合键以显示有效参数的列表。
Ctrl + Q 快速文档
Ctrl + Alt + S 设置
Ctrl + / 行注释
shift+F10 运行
4.简单使用
新建工程
I:\PyCharm_WorkSpace\Projects\untitled为工程路径
选择Existing interpreter,路径为Python的安装路径,然后点击Create
新建Python文件
文件名为:xlRd&Wt_test1
键入print(“Hellow CYY-~”)
打开控制台信息
运行:快捷键组合shift + F10,结果显示
4.简单语法学习
链接:https://www.w3school.com.cn/python/python_syntax.asp
按照语法训练在文本里面多次练习
实例:
if 5 > 2:
print(“Five is greater than two!”)
if 5 > 2:
print(“Five is greater than two!”)
if 5 > 2:
print(“Five is greater than two!”)
x = 10
y = “Bill”
print(x)
print(y)
x = 5 # x is of type int
x = “Steve” # x is now of type str
print(x)
x, y, z = “Orange”, “Banana”, “Cherry”
print(x)
print(y)
print(z)
x = “awesome”
print("Python is " + x)
x = "Python is "
y = “awesome”
z = x + y
print(z)
x = 5
y = 10
print(x + y)
x = 10
y = “Bill”
print(x + y)
错误:数字和字符串不能组合起来
…