• Python安装与环境变量


    Python安装与环境变量的配置

     python下载:

             Python安装包下载地址:http://www.python.org/

                                                                   根据实际的操作系统,安装合适的安装版本。

       Python安装:

            本文以python 2.7.8(64位)为例说明,具体安装步骤如下:

            1.双击下载包,进入Python安装向导。

     

            2.选择安装目录。如:D:Python27

           

     

             3.选择 Add python.exe to Path>>Entire feature will be installed on local hard drive 

          

     

              4.点击“Next”,继续下一步安装操作。

       

                到此为止,Python安装步骤已经全部完成。

                接下来需要检查安装是否OK。操作命令:在cmd下输入python,如果出现以下界面说明安装成功,否则需要配置环境变量。

        

                

      环境变量配置:

             方法一:使用cmd命令添加path环境变量

                      在cmd下输入: path=%path%;D:Python27  接着按"Enter"回车键。   

                      其中D:Python27  是Python的安装目录。

             方法二:在环境变量中添加Python目录

                      (1) 右键点击"计算机",然后点击"属性"

                      (2) 然后点击"高级系统设置"

                      (3) 选择"系统变量"窗口下面的"Path",双击即可!

                      (4) 然后在"Path"行,添加python安装路径即可(我的D:Python27) ps:记住,路径直接用分号""隔开!

                     

                    (5) 最后设置成功以后,在cmd命令行,输入命令"python",就可以有相关显示。

     同时在装两个版本的情况,配置好环境变量后可以修改文件名:python3和pythonw3

    path: D:Python36Scripts;D:Python36;

    根据使用不同的版本来使用python解释器

           

     然后如下图:

    windows环境变量默认配置路径:

    环境变量中编辑path

    ;C:UsersAdministratorAppDataLocalProgramsPythonPython38

    ;C:UsersAdministratorAppDataLocalProgramsPythonPython38Scripts

    ;C:UsersAdministratorPycharmProjectspythonProjectvenvLibsite-packagesdjangoin

    PythonPython38 下的路径主要用于服务

    Python38Scripts 下的路径主要用于pip安装

    django环境变量设置主要能到目录下应用到django-admin.py这个文件

    然后到cmd 或者pycharm控制台的Terminal下输入django-admin.py 成功会提示功能介绍

    如果失败:ModuleNotFoundError: No module named 'django'

    C:UsersAdministrator>pip install django

    提示:Successfully installed asgiref-3.3.1 django-3.1.3 pytz-2020.4 sqlparse-0.4.1

    C:UsersAdministrator>django-admin.py

    Type 'django-admin.py help <subcommand>' for help on a specific subcommand.

    也可以在terminal下输入

    #创建应用名为 myapp 这个工程
    python manage.py startapp myapp

    #生成sqlite3数据库文件
    python manage.py makemigrations
    python manage.py migrat


    #启动服务
    python manage.py runserver
    #打开网页测试:
    http://127.0.0.1:8000/

  • 相关阅读:
    线性反馈系统
    静磁场
    平面波的传播
    Partition does not end on cylinder boundary
    FFTW简介及使用
    EINTR、ERESTARTSYS和SIGINT
    凉面
    linux Shell编程
    Linux From Scratch [2]
    Linux From Scratch [1]
  • 原文地址:https://www.cnblogs.com/zhiqiao/p/8590337.html
Copyright © 2020-2023  润新知