文章目录
2024年3月5日
操作环境:
Win11-23H2
Python-3.12.2
PyCharm-2023.3.4
一、Python
点击Download,查看对应的版本( prerelease预发布版,bugfix修补版,security稳定版)

点击windows下载对应版本

版本详情页面往下选择对应系统的安装包,我的是64位windows

下载好后,依次点击

点击Close完成安装,重启电脑

按Win+R打开运行界面,输入cmd打开命令提示符
cmd
cmd
在命令提示符输入
cmd
python -V

出现版本则安装成功
二、更改镜像源下载库
继续在命令提示符中输入
cmd
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

出现Writing to C:\Users\13038\AppData\Roaming\pip\pip.ini表示成功
此后下载库即可从清华源下载(举例pyquery)

如果报错,可能是因为pip版本不够(需≥10.0.0),先升级pip:
cmdpip install pip -U
或者使用清华源进行更新pip
cmdpip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip
三、PyCharm
https://www.jetbrains.com/zh-cn/pycharm/download/?section=windows
选择下方的PyCharm Community Edition对应的下载

进行安装

安装完成后,重启电脑
四、汉化
打开Pycharm,在插件界面搜索Chinese,选择Chinese(Simplified),点击install安装,根据提示重启Pycharm

五、第一个项目配置
选择新建项目,配置如图所示
解释器类型,如果选择项目venv,那么Python 虚拟环境将在项目根中根目录中创建,也就是项目Python独立于全局Python
选择自定义环境,使用刚才安装的Python,会继承之前下载的库,路径为
C:\Users\13038\AppData\Local\Programs\Python\Python312
不同的Python版本,路径有所不同

在项目文件夹右键,新建,Python文件,命名

输入代码
python
s="helloworld"
print(s)
shift+F10运行
