python基础学习笔记-安装(1)

安装python

官网下载安装包https://www.python.org/

windows系统

官网下载exe包,傻瓜式安装
参考廖雪峰python
https://www.liaoxuefeng.com/wiki/1016959663602400/1016959856222624

linux(centos)

linux安装python3,python2系统自带
安装依赖包

yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel zlib-devel

官网下载python安装包,解压,进入到解压目录

tar -zxvf Python-3.6.1.tgz
cd Python-3.6.1/

指定安装目录安装`

./configure --prefix=/usr/local/python3 #--prefix指定安装目录
make
make altinstall

建立软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

修改环境变量

vim ~/.bash_profile

增加

export PATH=$PATH:$HOME/bin:/usr/local/python3/bin

安装库

在线安装 pip install XX

pip -标准库管理库
python3.4及python2.7.9,pip直接包括在python安装包内,不需要额外安装
例如:

pip install pytest
pip install -U pytest  #-U 覆盖安装
pip install pytest==3.8.2   #指定版本号安装
pip install -i http://mirrors.aliyun.com/pypi/simple/ pytest #使用国内源站下载

pip库
https://pypi.org/

国内源站:
(1)阿里云 http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣http://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学http://pypi.hustunique.com/

pip 命令

>pip --help
 pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.
离线安装
.tar.gz 或.zip安装包

解压.tar.gz

 tar -xzvf xxx.tar.gz 

解压".zip"文件

unzip xxx.zip

进入目录解压目录

cd xxx

执行

python setup.py install
".whl"文件安装

下载.whl文件

pip install XXX.whl

pycharm

安装

官网下载社区版,免费
https://www.jetbrains.com/pycharm/
在这里插入图片描述

pycharm快捷键

批量注释:Ctrl + /
替换:ctrl+r
查找:ctrl+F
全局查找:ctrl+shift+F
全局替换:ctrl+shift+R
缩进、不缩进:Tab、Shift + tab
复制粘贴一行:ctrl+d
查看类的继承关系:ctrl+h
查看api文档:shift+F1
查看类的方法:ctrl+F12
查看参数:ctrl+p:
查看文档描述:ctrl+q
运行:shift+F10

pycharm主题
主题下载

http://www.themesmap.com/

主题设置

下载主题
点击 file > import setting,选择下载的主题
点击 file > settings > editor > color scheme > 选择已经导入的主题

报错
(venv) D:\PycharmProjects\demo>pip install -i http://pypi.douban.com/simple/ pytest
Looking in indexes: http://pypi.douban.com/simple/
WARNING: 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 we recommend you use HTTPS instead
, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement pytest
ERROR: No matching distribution found for pytest
WARNING: 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 we recommend you use HTTPS instead
, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.

按提示,增加’–trusted-host pypi.douban.com’

pip install -i http://pypi.douban.com/simple/ pytest --trusted-host pypi.douban.com

参考资料:
廖雪峰
https://www.liaoxuefeng.com/wiki/1016959663602400/1016959856222624
python文档中文:
https://docs.python.org/zh-cn/3/
python文档英文文:
https://docs.python.org/zh-cn/3/
菜鸟教程:
https://www.runoob.com/python3/python3-tutorial.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值