# 安装要求的包
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install sklearn==1.0.8 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip uninstall sklearn
# 生成requirements.txt文件:
pip freeze>requirements.txt
# conda环境操作
直接在win+R,输入cmd中进行
1.检验当前conda的版本
conda -V
2、查看已有的虚拟环境
conda env list
3、创建虚拟环境
conda create -n env_name python=x.x
4、删除虚拟环境
conda remove -n env_name --all
5、激活虚拟环境
conda activate env_name
6、关闭虚拟环境
conda deactivate
# 将代码起起来:
在终端中输入:python manage.py runserver
# ./含义
jieba.load_userdict("./userdict.txt") # ./代表当前文件的上一级文件所在位置
# pycharm中有些包无法用pip直接导入办法
如果import导包不成,就进入这个网站下载对应的包https://www.lfd.uci.edu/~gohlke/pythonlibs/,比如下载到了d盘,那么可以在pycharm的终端输入pip install D:\fasttext-0.9.2-cp38-cp38-win_amd64.whl
# joblib一般直接到这个包就行,不需要从别的包from
import joblib
# 一般导入keras包要先从tensorflow中导出
from tensorflow.keras.preprocessing.text import Tokenizer
# 当dataframe中的数据有none时(一般是从数据库中读出的空值)
可以用函数.isnull()取出对应的空值
# 如何和前端联调
第一种方法:不需要连接同一个网络调,发host给前端
cpolar下载网址https://dashboard.cpolar.com/get-started
在manage.py编辑中的parameters添加runserver或者在终端输入python manage.py runserver,然后在cmd中输入cpolar http 8000即可
第二种方法:需要连接同一个网络调
在manage.py编辑中的parameters添加runserver 192.168.110.149:8000或者在终端输入python manage.py runserver 192.168.110.149:8000,然后直接将server给前端
python一些操作命令
于 2022-10-16 20:53:36 首次发布