type
status
date
slug
summary
tags
category
icon
password
写在前面:
由于之前的电脑用户名是中文(哭死),导致产生了一系列的问题,昨天重置了电脑,一切从头开始,故写此文记录我的环境配置过程。
Anaconda
用来产生独立的环境,同时易于安装库文件
- 下载链接:https://www.anaconda.com/download/
安装时,点击exe文件,Install for时选择Just Me,在之后选择将Anaconda3加入到PATH中,这样之后就不用自己再配路径了
- 之后,可以在terminal中输入activate即可激活base,之后可以使用conda指令来解决问题
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb583b72a-5a37-4921-bcb0-741b6137d1c7%2FUntitled.png?table=block&id=f9eca557-18cd-48eb-875d-ac3e06e12930&t=f9eca557-18cd-48eb-875d-ac3e06e12930&width=432&cache=v2)
- 使用
conda create -n 环境名字 python=python版本
即可建立新的环境
- btw,使用Anaconda就可以直接转好python了,不用再手动下载python
Jupyter Notebook
实时代码、方程、可视化以及解释性文本的文档
我是直接用VScode来编辑ipynb文件(感觉好用一点)
- 需要先安装下面的
Jupyter
插件
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff1bbbfc8-7bc5-4315-963e-b7f853aef241%2FUntitled.png?table=block&id=94ee4d0d-7797-4286-b310-ad107fd70e57&t=94ee4d0d-7797-4286-b310-ad107fd70e57&width=480&cache=v2)
- 之后,选择内核(可以选择python环境的内核)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F84b55a25-9ecf-4026-a038-e6d6e94a9769%2FUntitled.png?table=block&id=00f24061-5ed9-4198-be75-059d47d9f35f&t=00f24061-5ed9-4198-be75-059d47d9f35f&width=576&cache=v2)
- 注意:在内核中应该先使用
conda install -n 环境名称 ipykernel --update-deps --force-reinstall
在环境中安装ipykernel库,同时确保依赖更新,解决环境问题。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F92ef2208-3694-4205-9a11-9eac1332fd89%2FUntitled.png?table=block&id=cdd1ea53-ce2f-40f2-a2b7-5b1972401423&t=cdd1ea53-ce2f-40f2-a2b7-5b1972401423&width=2247&cache=v2)
- 之后要安装环境中没有的依赖时使用下面的代码即可安装(!后即可跟着指令)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1aa0a96a-d12d-405f-be8f-6034d4fbbe1e%2FUntitled.png?table=block&id=f46193bf-eb9c-409f-a536-93dcc4b8cd61&t=f46193bf-eb9c-409f-a536-93dcc4b8cd61&width=432&cache=v2)
Pycharm
python IDE
- 先进行学籍认证,之后再进行下载 下载链接:https://www.jetbrains.com/pycharm/
- 使用conda环境进行编译
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3edd98df-98f6-45d6-adba-864a68ba9f1f%2FUntitled.png?table=block&id=d75f4351-856d-43ae-9ca5-57cecd252352&t=d75f4351-856d-43ae-9ca5-57cecd252352&width=432&cache=v2)
- 安装包的三种方式
- 命令行安装(推荐)
- 点击红色灯泡安装
- python package处查找安装
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F353763ef-4872-4dad-a7b0-c46b57f7bd3d%2FUntitled.png?table=block&id=1ab8876c-83ee-408d-9514-ddef4915edec&t=1ab8876c-83ee-408d-9514-ddef4915edec&width=2378&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F7d233054-521e-45c9-b677-59497a3a2e0a%2FUntitled.png?table=block&id=c1df5b2e-c60a-49bf-b16d-47cc92cde93b&t=c1df5b2e-c60a-49bf-b16d-47cc92cde93b&width=1337&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F895ec2f5-a5bb-41fa-a57d-96a8965209cd%2FUntitled.png?table=block&id=8a412212-35cc-4892-b12e-4c465b2cfcd5&t=8a412212-35cc-4892-b12e-4c465b2cfcd5&width=2799&cache=v2)
- 直接生成requirements.txt https://blog.csdn.net/COCO56/article/details/117452383
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0a1f83d5-c98c-4ebc-9bc6-075c42fecc7e%2FUntitled.png?table=block&id=dcc8283f-d322-49d1-a9d2-415b6ceef110&t=dcc8283f-d322-49d1-a9d2-415b6ceef110&width=919&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fa7aadd43-314e-45fa-ae29-ddde1034f138%2FUntitled.png?table=block&id=a92900d9-07cd-4048-835c-81d1e5bfe8cd&t=a92900d9-07cd-4048-835c-81d1e5bfe8cd&width=797&cache=v2)
- 作者:王大卫
- 链接:https://tangly1024.com/article/note:python_env
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。