代码BUG疑难操作[持续更新]
PKL导入模型时报错 'ascii' codec can't decode byte
pkl.load(f,encoding='iso-8859-1')
vscode 无法导入自定义包,无法import No module named
- 在python安装路径的Lib\site-packages文件夹下新建一个任意命名的 .pth文件,如pythonwork.pth
- 在文件中加上python项目的目录,如:H:\python\test
- 重启vscode,问题得到解决
Nginx 使用UpStream进行SNI分流
stream {
log_format stream '$remote_addr [$time_local] [$ssl_preread_server_name] [$upstream] $status $bytes_sent $bytes_received $session_time';
access_log /opt/nginx/logs/stream.log stream;
map $ssl_preread_server_name $upstream {
default xxxxxxx;
}
upstream xxxx{
server xxxxx;
}
upstream xxxxxxxxx{
server xxxxx;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass $upstream;
ssl_preread on;
ssl_certificate server.pem;
ssl_certificate_key server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
}
}
MacBook M1 安装 pytorch_geometric
pip install --verbose torch-scatter torch-sparse torch-geometric
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
# Generate sample data
X, y_true = make_blobs(n_samples=300, centers=4,
cluster_std=0.60, random_state=0)
# Apply K-Means++
kmeans = KMeans(n_clusters=4, init='k-means++', max_iter=300, n_init=10, random_state=0)
pred_y = kmeans.fit_predict(X)
# Visualize the result
plt.scatter(X[:, 0], X[:, 1], c=pred_y)
快来做第一个评论的人吧~