Windows下配置Anconda 3后的一个小问题(pip连接不上)

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/a1220364463/article/details/88555269

pip中出现SSL/TSL问题

    今天把Anconda 2换成了Anconda 3,一切都好,就是pip出问题了,报错是SSL/TSL的问题。

    在网上也找了其他方式,比如用镜像下载。是可行的,但是比较麻烦,所以本人决定去找原因。

    我在python中import ssl,报错,说明openssl有问题。

    去网上下载了openssl安装好后再import ssl,没问题了。pip也好用了。

展开阅读全文

一个socket连接后的小问题

03-27

#include rn#pragma hdrstoprn#include rn#include "Main.h"rn#pragma package(smart_init)rn#pragma resource "*.dfm"rnTForm1 *Form1;rnrnunsigned long p_ulPort = 8846;rn//服务器监听线程rnDWORD WINAPI p_threadServerListen(LPVOID lpParameter);rn//服务器应答线程rnDWORD WINAPI p_threadServerRecv(LPVOID lpParameter);rnrn__fastcall TForm1::TForm1(TComponent* Owner)rn : TForm(Owner)rnrnrnDWORD WINAPI p_threadServerRecv(LPVOID lpParameter)rnrn char szBuff[1024];rn char szCmd[1024], szParams[1024];rn int n, x;rn bool bAuth = false;rn SOCKET client = (SOCKET)szParams;rn //第一次发送字符串给Clientrn strcpy(szBuff, "Server Read... ...\r\n");rn send(client, szBuff, strlen(szBuff), 0);rn Form1->Memo1->Lines->Add(szBuff);rnrn while(true)rn rn //收到来自Client的字符串rn n = recv(client, szCmd, 1024, 0);rn if ( n == SOCKET_ERROR)rn break;rn szBuff[0] = 0;rn Form1->Memo2->Lines->Add(szCmd);//Memo2不能显示来自Client的字符串rn if (szCmd == "QUIT")rn break;rn if (szCmd == "passwd")rn rn bAuth = true;rn strcpy(szBuff, "ACK\0");rn rn elsern rn strcpy(szBuff, "ERROR\0");rn rn //第二次发送字符串给Clientrn send(client, szBuff, strlen(szBuff), 0);rn Form1->Memo1->Lines->Add(szBuff);rn rn closesocket(client);rn return 0;rnrnDWORD WINAPI p_threadServerListen(LPVOID lpParameter)rnrn SOCKET server;rn WSADATA wsaData;rn sockaddr_in local;rn int iError = WSAStartup(0x101, &wsaData);rn if (iError != 0)rn return 0;rn local.sin_family = AF_INET;rn local.sin_addr.s_addr = INADDR_ANY;rn local.sin_port = htons((u_short)p_ulPort);rn server = socket(AF_INET, SOCK_STREAM, 0);rn if (server == INVALID_SOCKET)rn return 0;rn if (bind(server, (sockaddr*)&local, sizeof(local)) != 0)rn return 0;rn if (listen(server, 10) != 0)rn return 0;rn Form1->Memo1->Lines->Add("正在临听");rn SOCKET client;rn sockaddr_in from;rn int fromlen = sizeof(from);rn HANDLE hClient = NULL;rn while(true)rn rn client = accept(server, (struct sockaddr*)&from, &fromlen);rn hClient = CreateThread(NULL, 0, &p_threadServerRecv, (LPVOID)client, 0, NULL);rn rn Form1->Memo1->Lines->Add("结束监听");rn closesocket(server);rn WSACleanup();rn return 0;rnrnvoid __fastcall TForm1::Button1Click(TObject *Sender)rnrn //创建服务器监听线程rn HANDLE hServerListen = NULL;rn hServerListen = CreateThread(NULL, 0, &p_threadServerListen, NULL, 0, NULL);rn if (hServerListen == NULL)rn rn Memo1->Lines->Add("不能建立Server监听线程");rn rnrn//以上为服务端程序,以下为客户端程序rn#include rn#pragma hdrstoprn#include rn#include "main.h"rn#pragma package(smart_init)rn#pragma resource "*.dfm"rnTForm1 *Form1;rnunsigned long p_ulServerPort = 8846;rn//客户端线程rnDWORD WINAPI p_threadClientSocket(LPVOID lpParameter);rnrn__fastcall TForm1::TForm1(TComponent* Owner)rn : TForm(Owner)rnrnvoid __fastcall TForm1::Button1Click(TObject *Sender)rnrn HANDLE hThreadClient = NULL;rn hThreadClient = CreateThread(NULL, 0, *p_threadClientSocket, NULL, 0, NULL);rn if (hThreadClient == NULL)rn rn ShowMessage("不能建立线程");rn rn Button1->Enabled = false;rnrnDWORD WINAPI p_threadClientSocket(LPVOID lpParameter)rnrn const char* szServerIP = Form1->Edit1->Text.c_str();rn WSADATA wsaData;rn struct hostent *hp;rn unsigned int uiAddr;rn struct sockaddr_in server;rn int iError = WSAStartup(0x101, &wsaData);rn if (iError)rn return 0;rn SOCKET conn;rn conn = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);rn if (conn == INVALID_SOCKET)rn return 0;rn if (inet_addr(szServerIP) == INADDR_NONE)rn rn hp = gethostbyname(szServerIP); //DNS地址rn elsern rn uiAddr = inet_addr(szServerIP);rn hp = gethostbyaddr((char*)&uiAddr, sizeof(uiAddr), AF_INET); //IP地址rn rn if (hp == NULL)rn rn closesocket(conn);rn return 0;rn rn server.sin_addr.s_addr = *((unsigned long*)hp->h_addr); //server地址(ip or DNS)rn server.sin_family = AF_INET;rn server.sin_port = htons(p_ulServerPort);rn connect(conn, (struct sockaddr*)&server, 10);rn if (connect(conn, (struct sockaddr*)&server, sizeof(server)))rn rn closesocket(conn);rn Form1->Memo1->Lines->Add("不能连接");rn return 0;rn rn Form1->Memo1->Lines->Add("已连接"+Form1->Edit1->Text);rn char szBuff[1024], szCmd[1024];rn int z;rn //收到Server的第一次应答字符串rn z = recv(conn, szBuff, 1024, 0);rn szBuff[z] = 0;rn Form1->Memo2->Lines->Add(szBuff);//Memo2不能显示来自Server的字符串rn //第一次发送字符串给Serverrn strcpyszCmd"passwd\0");rn send(conn, szCmdstrlenszCmd0);rn Form1->Memo1->Lines->AddszCmdrn //收到Server的第二次应答字符串rn z = recv(conn, szBuff, 1024, 0);rn szBuff[z] = 0;rn Form1->Memo2->Lines->Add(szBuff);//Memo2不能显示来自Server的字符串rn rn closesocket(conn);rn WSACleanup();rn Form1->Memo1->Lines->Add("关闭连接");rn Form1->Button1->Caption = "connect";rn return 0;rnrnrn//通过工具测试连接成功,Server的"Server Read... ..."字符串也出现了,但就是在client与server都不能收到对方发过来的字符串,或收到字符串而不能在各自的Form1->Memo2上显示出来,是什么会事啊?rnrnrn 论坛

Ubuntu上配置git连接github连接不上

05-30

用以下命令ssh -vT git@github.comrnUbuntu上配置git连接github连接不上,报如下:rnrnOpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 19: Applying options for *rndebug1: Connecting to github.com [204.232.175.90] port 22.rndebug1: Connection established.rndebug1: permanently_set_uid: 0/0rndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: identity file /root/.ssh/id_dsa type -1rndebug1: identity file /root/.ssh/id_dsa-cert type -1rndebug1: identity file /root/.ssh/id_ecdsa type -1rndebug1: identity file /root/.ssh/id_ecdsa-cert type -1rndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github12rndebug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github12 pat OpenSSH*rndebug1: Enabling compatibility mode for protocol 2.0rndebug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1rndebug1: SSH2_MSG_KEXINIT sentrndebug1: SSH2_MSG_KEXINIT receivedrndebug1: kex: server->client aes128-ctr hmac-md5 nonerndebug1: kex: client->server aes128-ctr hmac-md5 nonerndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentrndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPrndebug1: SSH2_MSG_KEX_DH_GEX_INIT sentrndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYrndebug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48rndebug1: Host 'github.com' is known and matches the RSA host key.rndebug1: Found key in /root/.ssh/known_hosts:1rndebug1: ssh_rsa_verify: signature correctrndebug1: SSH2_MSG_NEWKEYS sentrndebug1: expecting SSH2_MSG_NEWKEYSrndebug1: SSH2_MSG_NEWKEYS receivedrndebug1: Roaming not allowed by serverrndebug1: SSH2_MSG_SERVICE_REQUEST sentrndebug1: SSH2_MSG_SERVICE_ACCEPT receivedrndebug1: Authentications that can continue: publickeyrndebug1: Next authentication method: publickeyrndebug1: Trying private key: /root/.ssh/id_rsarndebug1: Trying private key: /root/.ssh/id_dsarndebug1: Trying private key: /root/.ssh/id_ecdsarndebug1: No more authentication methods to try.rnPermission denied (publickey).rnrn请各位大神帮下忙 论坛

server2003 安装 SqlServer2005后 ,连接不上 ??

12-02

RTrn环境:虚拟机 新装的 server 2003 如下图:rn[img=https://img-bbs.csdn.net/upload/201312/02/1385990259_710193.jpg][/img]rnrn安装好 sql server 2005 和 SQLServer2005_SSMSEE.msi ,创建了数据库 zcTest ,在 VC6 中用如下代码连接数据库:rn[code=c]rnrn // 初始化COM,创建ADO连接等操作rn CoInitialize(NULL); // AfxOleInit();rn printf("1\n");rn g_pConnection.CreateInstance(__uuidof(Connection)); rn printf("2\n");rnrn // 在ADO操作中建议语句中要常用try...catch()来捕获错误信息,rn // 因为它有时会经常出现一些想不到的错误rn tryrn rn /*rn g_pConnection->Open(rn "Provider=SQLOLEDB;server=33-68389125959\\SQLEXPRESS;database=zcTest;UID=sa;PWD=123456",rn "", "", adModeUnknown);rn //*/rn //*rn g_pConnection->Open(rn "Provider=SQLOLEDB;server=192.168.1.110\\SQLEXPRESS;database=zcTest;UID=sa;PWD=123456",rn "", "", adModeUnknown);rn //*/rn printf("SQL_Test1\n");rn rn catch(_com_error e) rn rn printf("数据库连接 err :\n");rn printf("%s\n", e.ErrorMessage());rn printf("%s\n", (char*)e.Description());rn return;rn rnrn[/code]rn但是,有报错:rn[img=https://img-bbs.csdn.net/upload/201312/02/1385990492_921014.jpg][/img]rnrnrn于是,尝试用 “管理工具-->ODBC --> 创建到 sql server 的新数据源”的方式来连接数据库,但是 也报错了,NT验证 和 ID密码的SelServer验证 都出现下面的错误 :rn[img=https://img-bbs.csdn.net/upload/201312/02/1385990666_863385.jpg][/img]rnrnrn请问,我如何才能用 代码 或 ODBC 连上 sql server 2005 啊??? (SQL_Server_Management_Studio_Express 是可以用sa账户连上的,上面还创建了数据库的)rnrn求教啊 !!! 感谢 。rnrnrnrn 论坛

没有更多推荐了,返回首页