【Python配置环境变量】2024最新版Python安装教程(附带详细步骤)!!!

一、Python安装

1、访问官网

打开浏览器,访问Python官网

2、下载Python安装包

        2.1、在官网首页,找到并点击“Downloads”按钮。

        2.2、根据您的操作系统(Windows、macOS、Linux等)选择合适的版本。对于Windows用户,通常会看到“Windows x86-64 executable installer”(64位)和“Windows x86 executable installer”(32位)两个选项,建议选择64位版本以获取更好的性能。

        2.3、点击下载链接,等待安装包下载完成。

 

3、安装Python

3.1、双击下载好的安装包文件(如python-3.x.x-amd64.exe),启动安装向导。

3.2、在安装选项中,可以选择“Install Now”(默认安装)或“Customize installation”(自定义安装)。

在自定义安装界面中,可以选择安装哪些Python组件,以及安装目录。建议选择常用的文件夹作为安装目录,并确保路径中不包含中文和特殊字符。

建议初学者选择自定义安装,以便更好地控制安装过程和安装位置。

3.3、勾选“Add Python x.x to PATH”选项(如果可用),这样安装完成后Python会自动添加到系统的环境变量中,方便后续使用。如果未勾选此选项,则需要手动配置环境变量。注意下面的选项一定要勾选

3.4、点击“Install”开始安装过程,等待安装完成。

二、配置环境变量(如未在安装过程中配置)

如果安装Python时没有勾选“Add Python x.x to PATH”选项,或者需要手动调整环境变量,可以按照以下步骤进行:

  1. 找到Python安装路径
    • 在文件资源管理器中,浏览到Python的安装目录。通常,安装路径类似于C:\Python3xD:\Python3x,其中3x代表Python的版本号。
  2. 复制Python安装路径
    • 右键点击Python安装目录的路径栏,选择“复制”或使用快捷键Ctrl+C复制路径。
  3. 打开系统属性
    • 右键点击“此电脑”或“我的电脑”,选择“属性”。
    • 在系统界面中,点击左侧的“高级系统设置”。
  4. 编辑环境变量
    • 在系统属性窗口中,点击“环境变量”按钮。
    • 在环境变量窗口中,找到“系统变量”下的“Path”变量,选择后点击“编辑”。
    • 在编辑环境变量窗口中,点击“新建”按钮,将复制的Python安装路径粘贴到新建行中。注意,如果Python安装在具有空格的路径下,需要用引号将整个路径括起来。
    • 点击“确定”保存更改。
  5. 验证配置
    • 打开命令提示符(CMD)或PowerShell窗口。
    • 输入python命令并按回车键,如果系统能够正确识别并执行Python命令,显示Python的版本信息,则说明环境变量配置成功。

最后,如果你也想自学Python,可以关注我。我会把踩过的坑分享给你,让你不要踩坑,提高学习速度,还整理出了一套系统的学习路线,这套资料涵盖了诸多学习内容:开发工具,基础视频教程,项目实战源码,51本电子书籍,100道练习题等。相信可以帮助大家在最短的时间内,能达到事半功倍效果,用来复习也是非常不错的。

Installing c++/g++ on Windows Disclaimer: This page is being maintained mainly for my students. Use these instructions at your own risk. There is no warranty in any form or shape whatsoever!. There is no guarantee that these instructions are up-to-date. With that understood you may continue with the rest of this page if you choose to accept these terms. This page was last updated on September 13, 2005, but still good as of April 30, 2009. Follow these steps to install g++ (the GNU C++ compiler) for Windows. There is no room for creativity here; you must follow the directions exactly. Pick the drive and a folder in which you want to install g++. I'll assume that it is C:, but you can choose a different one. If you choose a different drive or a different folder, you'll need to adapt the directions below accordingly. Download full.exe, an about 14 megabyte executable, to C:\full.exe by right-clicking on the link. Use Save Link As... or Save Target As... Be sure the browser saves the file as C:\full.exe. Run the downloaded executable. This will install g++ (and a lot of other things that you don't really need) on your hard drive. Go to the C: drive using Windows Explorer and double-click on full.exe. Or, open a DOS window (Start > Programs > Command Prompt), connect to the C: drive using the cd command, and type full. Locate where the bin folder was created for the g++ installation. On my Windows XP machine, it was created in the following path: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin You now should add it to the PATH environment variable. You do that by following: Start -> Control Panel -> System -> Advanced -> Environment Variables At this point you can see the PATH variable either in the User Variables or in the System Variables. Add the g++ path into the PATH variable. You add it to the end of the existing value separated by a semicolon (';'). Make sure that you do not lose the original value. You are just appending more to the end separated by a semicolon. Restart your computer. A Cygnus Solutions entry will appear in your Programs menu, and an icon may appear on your desktop. Don't use them! You will use it using the g++ command on a DOS prompt as explained below. You should now be able to run g++ from a DOS (Command Prompt) window. For example, to compile a file called C:\mine\hello.cpp, connect to the C:\mine folder and enter g++ -g hello.cpp -o hello -lm You'll then be able to run the compiled program by entering hello in the DOS window. If you've installed Emacs as described here, you will also be able to run g++ from Emacs. If, when you do this, Emacs tries to compile with the command make -k, you made a mistake during the Emacs installation. If you want to learn how to run g++ on emacs, see here. If you'd like to learn more about where this free compiler came from, we downloaded it from an older site of http://sourceware.org/cygwin/. If you wish to clean up a little, you may delete the file: full.exe at this point. Your g++ compiler is installed under C:\cygnus.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值