python学习

  • B3_563475
    了解作者
  • 1.7KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-08 02:28
    上传日期
python学习 安装Python 我们转到Python页面进行初始下载:( )在为Mac OSX选择了最新版本(3.9.2)之后,我将其下载到了我的计算机上。 然后,我们搜索了“ Python入门”,并确认VS Code是适用于Python的可行代码编写器之后,我们找到了一个入门教程,供您在VS Code上设置Python( )。这涉及到: 通过打开Mac Terminal并键入以下命令,使用Homebrew安装Python: brew安装python3 安装完成后,我们通过键入以下内容进行验证: python3-版本 这返回了最新版本3.9.2 然后我们开始了一个VS Code项目: mkdir hello cd你好代码。 在项目内部,我们通过打开命令面板并键入以下命令来选择一个Python解释器:Python:选择解释器。 然后,我们创建了一个名为“ hello
python-learning-main.zip
  • python-learning-main
  • README.md
    3KB
内容介绍
# python-learning Installing Python We went to the Python page for the intitial download: (https://www.python.org/downloads/) After selecting the most recent version (3.9.2) for Mac OSX, I downloaded it to my computer. Then, we googled "Getting Started with Python and, after verifying that VS Code was a viable code writer for Python, we found a beginning tutorial for getting Python set up on VS Code (https://code.visualstudio.com/docs/python/python-tutorial). This involved: Installing Python using Homebrew by opening the Mac Terminal and typing: brew install python3 Once installation was complete, we verified by typing: python3 --version this returned the most recent version 3.9.2 Then we started a VS Code project: mkdir hello cd hello code . Inside the project we selected a Python interpreter by opening the Command Pallette and typing: Python: Select Interpreter. Then we created a folder titled "hello" with a file titled "hello.py" and then in the file we entered the following code: msg = "Hello World" print(msg) To run the msg we cliked the Run Python File in Terminal play button which is a green arrow located in the top right hand corner of the code editor, next to the button that allows the user to split the screen. This runs the msg in the integrated terminal (print is synonomous with console.log in Python). Following the successful run of the Hello World message, the tutorial then directed us to use the debugger, by placing the cursor on "print" and selecting F9, or using the mouse to left click on the dot next to the line number, setting up a break point. Then pressing F5 initializes the debugger (the same can be done by going to the VS Code toolbar at the top of the screen and selecting the "Run" menu and then selecting "Start Debugger". To initialize the debugger, you need to select Python File when VS Code prompts you to select a debug configuration. A debugging toolbar appears at the top of the screen to facilitate in the debugging process. We also explored working with variables in the Debug Console in the integrated terminal: msg msg.capitalize() msg.split() The final portion of the tutorial involves installing and using packages. We're prompted to open a new file called "standardplot.py" and pasting in the following code: import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 20, 100) # Create a list of evenly-spaced numbers over the range plt.plot(x, np.sin(x)) # Plot the sine of each x point plt.show() # Display the plot Running this code through the debugger results in a message: "ModuleNotFoundError: No module named 'matplotlib'" because we have not previously installed the matplotlib package. The tutorial then directs you to set up a project-specific virtual environment in the terminal and then install the package with the following lines of code in the terminal: python3 -m venv .venv source .venv/bin/activate Then: python3 -m pip install matplotlib Finally, rerunning the program results in a pop up waveline graph.
评论
    相关推荐
    • Python
      Python
    • python
      Python 这是用于大多数基本和简单python代码的示例模板的存储库。
    • Python
      Python项目 Python是一些简单的Python项目,它是一种解释性的高级通用编程语言,我愿意学习它为将来的许多项目做出贡献! 入门 您必须安装Python 3.9.2才能尝试这些项目。 这些项目来自各种书籍,您可以根据需要进行...
    • Python
      Python Dit是Mijn储存库van Python
    • python
      Python 基本的python编程
    • Python
      Python python和pyspark
    • python
      关于python的学习资料。。。。。。。
    • Fluent Python
      This book was written for practicing Python programmers who want to become proficient in Python 3. If you know Python 2 but are willing to migrate to Python 3.4 or later, you should be fine. At the ...
    • Python
      Python 该存储库包含与Python编程研究相关的文档
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等