
python
赴前尘
惜春春去
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python为当前项目生成requirements.txt
python为当前项目生成requirements.txt原创 2023-12-18 10:50:51 · 464 阅读 · 0 评论 -
centos7卸载自带python2
centos7卸载自带python2。原创 2022-12-01 18:45:42 · 1008 阅读 · 1 评论 -
python中list 转set和tuple遇到的坑
#!/usr/bin/env python# -- coding: utf-8 --# @Time : 2020-12-24 15:51# @Author : wmy# @File : __init__.py.py#x = (1, 8, 5)print('set(x):{0}'.format(set(x)))print('tuple(x): {0}'.format(tuple(x)))result:原创 2020-12-29 15:32:01 · 1016 阅读 · 0 评论 -
pycharm运行pyspark错误:Java gateway process exited before sending its port number
1.右上角打开 Edit Configurations2. 点击 Environment variables,点击“+”,添加 PYTHONPATH=D:\spark-2.2.1\python(具体视自己安装的spark目录为准)原创 2020-10-26 19:47:34 · 1488 阅读 · 0 评论 -
flask+celery+redis异步延时处理
import timefrom celery import Celeryfrom flask import Flask, jsonifyapp = Flask(__name__)# 配置# 配置消息代理的路径,如果是在远程服务器上,则配置远程服务器中redis的URLapp.config['CELERY_BROKER_URL'] = 'redis://localhost:6379/0'# 要存储 Celery 任务的状态或运行结果时就必须要配置app.config['CELERY_RE.原创 2020-09-10 21:02:30 · 692 阅读 · 1 评论 -
python 嵌套列表求交集
# # -*- coding: utf-8 -*-# # @Time : 2020/7/10 01:16# # @Author : wmy''' 嵌套列表求交集'''c1 = {(11, 27, 29), (61, 63, 64), (11, 24, 70), (17, 18, 21), (55, 59, 65), (11, 35, 36), (24, 69, 70), (11, 58, 64), (48, 73, 74), (17, 19, 22), (11, 25, .原创 2020-07-10 13:17:29 · 834 阅读 · 0 评论 -
python将gml格式的图数据转为txt格式,点和边的字符值分别用数字替代
# -*- coding: utf-8 -*-import networkx as nximport copy# 抽取gml中的数据# networkx可以直接通过函数从gml文件中读出数据def read_gml(data): G = nx.read_gml(data) nodes = [] edges = [] nodes_id = dict()...原创 2019-12-31 19:02:06 · 1940 阅读 · 1 评论 -
非官方的用于Python扩展包的Windows二进制文件的安装
如 gmpy2的安装下面意思是作者停止了对python更高版本的维护?网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#gmpy下载 和python版本对应的whl文件,我用的 3.7x,下载的是gmpy2-2.0.8-cp37-cp37m-win_amd64.whlcmd 进入命令窗口:pip install gmpy2-2.0....原创 2019-10-21 14:53:07 · 320 阅读 · 0 评论 -
python -m pip install upgrade pip 失败改为安装指定pip版本成功
python -m pip install upgrade pipLooking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleCollecting upgrade Could not find a version that satisfies the requirement upgrade (from versions: )...原创 2019-10-21 11:11:21 · 941 阅读 · 0 评论 -
python实现离散特征的 LabelEncoder编码和OneHotEncoder编码
LabelEncoder: xxx为属性名from sklearn.preprocessing import LabelEncoderencoder = LabelEncoder()dataset['xxx'] = encoder.fit_transform(dataset['xxx'])OneHotEncoder:单独特征编码xxx为属性名import pandas ...原创 2019-07-23 18:07:39 · 958 阅读 · 0 评论 -
pycharm创建python文件时如何默认添加编码格式: # -*- coding: utf-8 -*-
第一步:File ->Settings第二步:Editor -> File and Code Templates -> Python Script第三步:在输入框内输入 # -*- coding: utf-8 -*- 并勾选 Enable Live Templates 选择框 点击 OK...原创 2019-07-06 18:10:38 · 9051 阅读 · 0 评论 -
python将源地址修改为国内镜像源
第一步:在 C:\Users\xxx 下面创建新的目录 pip第二步:在 pip目录下创建后缀为ini名为pip的文件 (pip.ini)文件内容设置为:(清华源)[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple第三步:测试命令: pip install matplotlib效...原创 2019-07-10 17:32:26 · 3814 阅读 · 0 评论 -
ImportError: No module named requests
错误描述:解决方案:1. File -> Settings -> Project:PycharmProjects -> Project Interpreter , 点击最右侧 +2.左上角搜索栏搜索 requests ,选中requests ,然后点击左下角 Install Package 进行安装3.下方提示安装成功,关掉页面,回到上一页面点...原创 2019-07-05 10:29:58 · 1940 阅读 · 0 评论 -
Typo: In word 'xxx' less... (Ctrl+F1) 去掉错误拼写检查提示
解决步骤:File -> SettingsEditor -> Code Style -> inspections -> Spelling -Typo 把勾选状态去掉,点击 OK即可原创 2019-07-08 09:45:43 · 7583 阅读 · 0 评论