|
@@ -8,6 +8,12 @@
|
|
|
"# 1、Git服务器的使用"
|
|
|
]
|
|
|
},
|
|
|
+ {
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "id": "62509140-276a-4a72-a7e9-7c3803368e60",
|
|
|
+ "metadata": {},
|
|
|
+ "source": []
|
|
|
+ },
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
"id": "5fd42243-063d-4056-bcc8-da35a3775199",
|
|
@@ -164,32 +170,9 @@
|
|
|
"source": []
|
|
|
},
|
|
|
{
|
|
|
- "cell_type": "code",
|
|
|
- "execution_count": 55,
|
|
|
- "id": "f08f4004-5a57-4178-8a04-47123ca894ed",
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "id": "393350e0-aab6-4004-8ccd-5dd358e46882",
|
|
|
"metadata": {},
|
|
|
- "outputs": [
|
|
|
- {
|
|
|
- "ename": "ImportError",
|
|
|
- "evalue": "cannot import name 'Image' from partially initialized module 'PIL' (most likely due to a circular import) (D:\\Program Files\\python\\python3.11\\PIL.py)",
|
|
|
- "output_type": "error",
|
|
|
- "traceback": [
|
|
|
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
|
- "\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
|
|
|
- "Cell \u001b[1;32mIn[55], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# 表示图像在页面上输出\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[43mget_ipython\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_line_magic\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmatplotlib\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43minline\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# 调用matplotlib的pyplot绘图模块来完成图像显示\u001b[39;00m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m \u001b[38;5;66;03m# 取别名,减少输入字符\u001b[39;00m\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\IPython\\core\\interactiveshell.py:2417\u001b[0m, in \u001b[0;36mInteractiveShell.run_line_magic\u001b[1;34m(self, magic_name, line, _stack_depth)\u001b[0m\n\u001b[0;32m 2415\u001b[0m kwargs[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlocal_ns\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_local_scope(stack_depth)\n\u001b[0;32m 2416\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuiltin_trap:\n\u001b[1;32m-> 2417\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 2419\u001b[0m \u001b[38;5;66;03m# The code below prevents the output from being displayed\u001b[39;00m\n\u001b[0;32m 2420\u001b[0m \u001b[38;5;66;03m# when using magics with decodator @output_can_be_silenced\u001b[39;00m\n\u001b[0;32m 2421\u001b[0m \u001b[38;5;66;03m# when the last Python token in the expression is a ';'.\u001b[39;00m\n\u001b[0;32m 2422\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(fn, magic\u001b[38;5;241m.\u001b[39mMAGIC_OUTPUT_CAN_BE_SILENCED, \u001b[38;5;28;01mFalse\u001b[39;00m):\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\IPython\\core\\magics\\pylab.py:99\u001b[0m, in \u001b[0;36mPylabMagics.matplotlib\u001b[1;34m(self, line)\u001b[0m\n\u001b[0;32m 97\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAvailable matplotlib backends: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m backends_list)\n\u001b[0;32m 98\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 99\u001b[0m gui, backend \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshell\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menable_matplotlib\u001b[49m\u001b[43m(\u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlower\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 100\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_show_matplotlib_backend(args\u001b[38;5;241m.\u001b[39mgui, backend)\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\IPython\\core\\interactiveshell.py:3588\u001b[0m, in \u001b[0;36mInteractiveShell.enable_matplotlib\u001b[1;34m(self, gui)\u001b[0m\n\u001b[0;32m 3567\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21menable_matplotlib\u001b[39m(\u001b[38;5;28mself\u001b[39m, gui\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m 3568\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Enable interactive matplotlib and inline figure support.\u001b[39;00m\n\u001b[0;32m 3569\u001b[0m \n\u001b[0;32m 3570\u001b[0m \u001b[38;5;124;03m This takes the following steps:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3586\u001b[0m \u001b[38;5;124;03m display figures inline.\u001b[39;00m\n\u001b[0;32m 3587\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m-> 3588\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib_inline\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackend_inline\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m configure_inline_support\n\u001b[0;32m 3590\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mIPython\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m pylabtools \u001b[38;5;28;01mas\u001b[39;00m pt\n\u001b[0;32m 3591\u001b[0m gui, backend \u001b[38;5;241m=\u001b[39m pt\u001b[38;5;241m.\u001b[39mfind_gui_and_backend(gui, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpylab_gui_select)\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\matplotlib_inline\\__init__.py:1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m backend_inline, config \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[0;32m 2\u001b[0m __version__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m0.1.6\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;66;03m# noqa\u001b[39;00m\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\matplotlib_inline\\backend_inline.py:6\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;124;03m\"\"\"A matplotlib backend for publishing figures via display_data\"\"\"\u001b[39;00m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# Copyright (c) IPython Development Team.\u001b[39;00m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Distributed under the terms of the BSD 3-Clause License.\u001b[39;00m\n\u001b[1;32m----> 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\n\u001b[0;32m 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m colors\n\u001b[0;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackends\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m backend_agg\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\matplotlib\\__init__.py:148\u001b[0m\n\u001b[0;32m 144\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpackaging\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mversion\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m parse \u001b[38;5;28;01mas\u001b[39;00m parse_version\n\u001b[0;32m 146\u001b[0m \u001b[38;5;66;03m# cbook must import matplotlib only within function\u001b[39;00m\n\u001b[0;32m 147\u001b[0m \u001b[38;5;66;03m# definitions, so it is safe to import from it here.\u001b[39;00m\n\u001b[1;32m--> 148\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api, _version, cbook, _docstring, rcsetup\n\u001b[0;32m 149\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcbook\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m sanitize_sequence\n\u001b[0;32m 150\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_api\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MatplotlibDeprecationWarning\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\matplotlib\\rcsetup.py:27\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api, cbook\n\u001b[0;32m 26\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcbook\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ls_mapper\n\u001b[1;32m---> 27\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcolors\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Colormap, is_color_like\n\u001b[0;32m 28\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_fontconfig_pattern\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m parse_fontconfig_pattern\n\u001b[0;32m 29\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_enums\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m JoinStyle, CapStyle\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\Lib\\site-packages\\matplotlib\\colors.py:51\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnumbers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Number\n\u001b[0;32m 50\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mre\u001b[39;00m\n\u001b[1;32m---> 51\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mPIL\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Image\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mPIL\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mPngImagePlugin\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PngInfo\n\u001b[0;32m 54\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpl\u001b[39;00m\n",
|
|
|
- "File \u001b[1;32mD:\\Program Files\\python\\python3.11\\PIL.py:1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mPIL\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Image\n\u001b[0;32m 2\u001b[0m im\u001b[38;5;241m=\u001b[39mImage\u001b[38;5;241m.\u001b[39mopen(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mD:\u001b[39m\u001b[38;5;130;01m\\\\\u001b[39;00m\u001b[38;5;124mpycodes\u001b[39m\u001b[38;5;130;01m\\\\\u001b[39;00m\u001b[38;5;124mbirdnest.jpg\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
|
|
- "\u001b[1;31mImportError\u001b[0m: cannot import name 'Image' from partially initialized module 'PIL' (most likely due to a circular import) (D:\\Program Files\\python\\python3.11\\PIL.py)"
|
|
|
- ]
|
|
|
- }
|
|
|
- ],
|
|
|
"source": [
|
|
|
"# 表示图像在页面上输出\n",
|
|
|
"# %matplotlib inline \n",
|
|
@@ -269,58 +252,10 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 49,
|
|
|
- "id": "2b30cab2-f838-482d-91fb-6a7fd518731f",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "f2e228de-b496-4444-bbdb-2f7fe898f65a",
|
|
|
"metadata": {},
|
|
|
- "outputs": [
|
|
|
- {
|
|
|
- "name": "stdout",
|
|
|
- "output_type": "stream",
|
|
|
- "text": [
|
|
|
- "106\n",
|
|
|
- "[[[106 31]\n",
|
|
|
- " [106 30]\n",
|
|
|
- " [110 31]\n",
|
|
|
- " [119 37]\n",
|
|
|
- " [131 46]]\n",
|
|
|
- "\n",
|
|
|
- " [[112 36]\n",
|
|
|
- " [112 34]\n",
|
|
|
- " [113 34]\n",
|
|
|
- " [121 39]\n",
|
|
|
- " [131 46]]\n",
|
|
|
- "\n",
|
|
|
- " [[121 43]\n",
|
|
|
- " [119 41]\n",
|
|
|
- " [119 39]\n",
|
|
|
- " [124 41]\n",
|
|
|
- " [130 44]]\n",
|
|
|
- "\n",
|
|
|
- " [[128 50]\n",
|
|
|
- " [127 48]\n",
|
|
|
- " [126 45]\n",
|
|
|
- " [127 44]\n",
|
|
|
- " [131 45]]\n",
|
|
|
- "\n",
|
|
|
- " [[133 55]\n",
|
|
|
- " [132 52]\n",
|
|
|
- " [131 49]\n",
|
|
|
- " [131 47]\n",
|
|
|
- " [132 46]]]\n"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "ename": "NameError",
|
|
|
- "evalue": "name 'plt' is not defined",
|
|
|
- "output_type": "error",
|
|
|
- "traceback": [
|
|
|
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
|
- "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
|
|
- "Cell \u001b[1;32mIn[49], line 11\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[38;5;66;03m#读取块\u001b[39;00m\n\u001b[0;32m 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(img[\u001b[38;5;241m0\u001b[39m:\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m0\u001b[39m:\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m0\u001b[39m:\u001b[38;5;241m2\u001b[39m]) \u001b[38;5;66;03m# 0:5 从0行到5行 [0,5]\u001b[39;00m\n\u001b[1;32m---> 11\u001b[0m \u001b[43mplt\u001b[49m\u001b[38;5;241m.\u001b[39mimshow(img[\u001b[38;5;241m0\u001b[39m:\u001b[38;5;241m200\u001b[39m:\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m100\u001b[39m:\u001b[38;5;241m200\u001b[39m,\u001b[38;5;241m0\u001b[39m:\u001b[38;5;241m3\u001b[39m],cmap\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgray\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;66;03m# 显示图像,必须是1,3,4通道\u001b[39;00m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;66;03m# :没有数字开始表示0,结束表示\u001b[39;00m\n\u001b[0;32m 13\u001b[0m \u001b[38;5;66;03m# :200:2表示0到200之间只取偶数行\u001b[39;00m\n\u001b[0;32m 14\u001b[0m img[::\u001b[38;5;241m2\u001b[39m,::\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m0\u001b[39m:] \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n",
|
|
|
- "\u001b[1;31mNameError\u001b[0m: name 'plt' is not defined"
|
|
|
- ]
|
|
|
- }
|
|
|
- ],
|
|
|
+ "outputs": [],
|
|
|
"source": [
|
|
|
"# bmp:位图 (原始存放像素) :图像大,不适合网络,图像的保真度很高\n",
|
|
|
"# jpg:压缩存放:RGB,图像的大小合适,主流的网络图片格式\n",
|