<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>水冰阁</title><link>http://gaohualing.cn/</link><description>Hello, world!</description><generator>RainbowSoft Studio Z-Blog 2.2 Prism Build 140101</generator><language>zh-CN</language><pubDate>Sun, 26 May 2024 19:39:07 +0800</pubDate><item><title>海南省疫情轨迹查询</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/49.html</link><pubDate>Sun, 09 Feb 2020 11:25:27 +0800</pubDate><guid>http://gaohualing.cn/post/49.html</guid><description><![CDATA[<p><a href="http://www.tangguomm.com/yiqing/location.html?openid=oNi6g5-laN8b_0-MDnLdEfZpvj08&openidend=&nickname=Missgao&nicknameend=&headingimgurl=http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJ19AR9PJ3cEsXoQQw0TuccX5PLEEZMNXfOF62Qptmz3SNsuPzmmAalcZJlNBvjRJrjibDTKhHediaQ/132&headingimgurlend=&isauth=&isauthend=&sonmerchantid=1&sonmerchantidend=&state=end" target="_blank" title="海南省疫情轨迹查询">海南省疫情轨迹查询</a><br/></p>]]></description><category>其他大杂烩</category><comments>http://gaohualing.cn/post/49.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=49</wfw:commentRss></item><item><title>python暑期专业实训-Day05代码参考</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/46.html</link><pubDate>Sun, 16 Sep 2018 22:23:03 +0800</pubDate><guid>http://gaohualing.cn/post/46.html</guid><description><![CDATA[<p>01_douban.py</p><p>------------------------------------</p><p>import requests</p><p>import json</p><p><br/></p><p>#1.url,</p><p>start_url_temp_list = [</p><p>&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;url_temp&quot;:&quot;https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_american_hot/items?os=ios&amp;for_mobile=1&amp;start={}&amp;count=18&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;country&quot;:&quot;US&quot;</p><p>&nbsp; &nbsp; },</p><p>&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;url_temp&quot;:&quot;https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_domestic_hot/items?os=ios&amp;for_mobile=1&amp;start={}&amp;count=18&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;country&quot;:&quot;CN&quot;</p><p>&nbsp; &nbsp; }</p><p>]</p><p><br/></p><p>headers = {&quot;Referer&quot;:&quot;&quot;,</p><p>&nbsp; &nbsp; &quot;User-Agent&quot;:&quot;Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1&quot;}</p><p><br/></p><p>def parse_url(url): #发送请求，获取响应的方法</p><p>&nbsp; &nbsp; print(&quot;现在正在请求：&quot;,url)</p><p>&nbsp; &nbsp; r = requests.get(url,headers=headers)</p><p>&nbsp; &nbsp; return r.content.decode()</p><p><br/></p><p>def get_content_list(json_response): #3.提取数据的方法</p><p>&nbsp; &nbsp; dict_response = json.loads(json_response)</p><p>&nbsp; &nbsp; content_list = dict_response[&quot;subject_collection_items&quot;]</p><p>&nbsp; &nbsp; total = dict_response[&quot;total&quot;]</p><p>&nbsp; &nbsp; return content_list,total</p><p><br/></p><p>def save_content_list(content_list): #保存content_list的方法</p><p>&nbsp; &nbsp; f = open(&quot;douban.txt&quot;, &quot;a&quot;,encoding=&quot;utf-8&quot;) #每次调用这个方法只打开了一次文件，关闭了一次稳健</p><p>&nbsp; &nbsp; for content in content_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; f.write(json.dumps(content,ensure_ascii=False,indent=2))</p><p>&nbsp; &nbsp; f.close()</p><p>&nbsp; &nbsp; print(&quot;保存成功&quot;)</p><p><br/></p><p>def run():#主要逻辑的实现</p><p>&nbsp; &nbsp; # 1.url,</p><p>&nbsp; &nbsp; for url_temp in start_url_temp_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; num = 0</p><p>&nbsp; &nbsp; &nbsp; &nbsp; total = 100</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if url_temp[&quot;country&quot;] == &quot;CN&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers.update({&quot;Referer&quot;:&quot;https://m.douban.com/tv/chinese&quot;})&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; elif url_temp[&quot;country&quot;] == &quot;US&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers.update({&quot;Referer&quot;:&quot;https://m.douban.com/tv/american&quot;})&nbsp;&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; while num&lt;=total+18: #假设最后还有10条数据没有取</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url = url_temp[&quot;url_temp&quot;].format(num)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.发送请求获取响应</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json_response = parse_url(url)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #3.提取数据</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content_list,total = get_content_list(json_response)</p><p><br/></p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for content in content_list:#添加国家信息</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content[&quot;country&quot;] = url_temp[&quot;country&quot;]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #4.保存</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; save_content_list(content_list)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = num +18</p><p><br/></p><p><br/></p><p>if __name__ == &#39;__main__&#39;:</p><p>&nbsp; &nbsp; run()</p><p>------------------------------------</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/46.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=46</wfw:commentRss></item><item><title>python暑期专业实训-Day04代码参考</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/45.html</link><pubDate>Sun, 16 Sep 2018 22:10:26 +0800</pubDate><guid>http://gaohualing.cn/post/45.html</guid><description><![CDATA[<p>01_douban.py</p><p>------------------------------</p><p>import requests</p><p>import json</p><p><br/></p><p>#1.url,</p><p>start_url_temp_list = [</p><p>&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;url_temp&quot;:&quot;https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_american_hot/items?os=ios&amp;for_mobile=1&amp;start={}&amp;count=18&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;country&quot;:&quot;US&quot;</p><p>&nbsp; &nbsp; },</p><p>&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;url_temp&quot;:&quot;https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_domestic_hot/items?os=ios&amp;for_mobile=1&amp;start={}&amp;count=18&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;country&quot;:&quot;CN&quot;</p><p>&nbsp; &nbsp; }</p><p>]</p><p><br/></p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1&quot;}</p><p><br/></p><p>def parse_url(url): #发送请求，获取响应的方法</p><p>&nbsp; &nbsp; print(&quot;现在正在请求：&quot;,url)</p><p>&nbsp; &nbsp; r = requests.get(url,headers=headers)</p><p>&nbsp; &nbsp; return r.content.decode()</p><p><br/></p><p>def get_content_list(json_response): #3.提取数据的方法</p><p>&nbsp; &nbsp; dict_response = json.loads(json_response)</p><p>&nbsp; &nbsp; content_list = dict_response[&quot;subject_collection_items&quot;]</p><p>&nbsp; &nbsp; total = dict_response[&quot;total&quot;]</p><p>&nbsp; &nbsp; return content_list,total</p><p><br/></p><p>def save_content_list(content_list): #保存content_list的方法</p><p>&nbsp; &nbsp; f = open(&quot;douban.txt&quot;, &quot;a&quot;,encoding=&quot;utf-8&quot;) #每次调用这个方法只打开了一次文件，关闭了一次稳健</p><p>&nbsp; &nbsp; for content in content_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; f.write(json.dumps(content,ensure_ascii=False,indent=2))</p><p>&nbsp; &nbsp; f.close()</p><p>&nbsp; &nbsp; print(&quot;保存成功&quot;)</p><p><br/></p><p>def run():#主要逻辑的实现</p><p>&nbsp; &nbsp; # 1.url,</p><p>&nbsp; &nbsp; for url_temp in start_url_temp_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; num = 0</p><p>&nbsp; &nbsp; &nbsp; &nbsp; total = 100</p><p>&nbsp; &nbsp; &nbsp; &nbsp; while num&lt;=total+18: #假设最后还有10条数据没有取</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url = url_temp[&quot;url_temp&quot;].format(num)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.发送请求获取响应</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json_response = parse_url(url)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #3.提取数据</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content_list,total = get_content_list(json_response)</p><p><br/></p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for content in content_list:#添加国家信息</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content[&quot;country&quot;] = url_temp[&quot;country&quot;]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #4.保存</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; save_content_list(content_list)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = num +18</p><p><br/></p><p><br/></p><p>if __name__ == &#39;__main__&#39;:</p><p>&nbsp; &nbsp; run()</p><p>------------------------------</p><p>01_try_requests.py</p><p style="white-space: normal;">------------------------------</p><p># coding=utf-8</p><p>import requests</p><p>url = &quot;http://www.baidu.com&quot;</p><p># url1 = &quot;www.baidu.com&quot;&nbsp; #当前这个url地址缺少协议</p><p>r = requests.get(url)</p><p>print(r)</p><p>#手动的指定编码方式</p><p># r.encoding = &quot;utf-8&quot;</p><p># print(r.text)</p><p><br/></p><p>#另一个种方式获取网页源码</p><p># print(type(r.content))</p><p>print(r.content.decode())</p><p style="white-space: normal;">------------------------------</p><p>02_baidu_tupian.py</p><p style="white-space: normal;">------------------------------</p><p># coding=utf-8</p><p>import requests</p><p>r = requests.get(&quot;https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white.png&quot;)</p><p>print(r.status_code)</p><p>print(r.headers)</p><p>print(&quot;*&quot;*10)</p><p>print(r.request.headers)</p><p>#保存图片或者视屏到本地的时候，需要保存二进制的数据 #r.content</p><p>f = open(&quot;baidu.png&quot;,&quot;wb&quot;)</p><p>f.write(r.content)</p><p>f.close()</p><p style="white-space: normal;">------------------------------</p><p>03_headers.py</p><p style="white-space: normal;">------------------------------</p><p># coding=utf-8</p><p>import requests</p><p><br/></p><p>#顶一个headers</p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&quot;}</p><p>url = &quot;http://www.baidu.com&quot;</p><p>r = requests.get(url,headers=headers)</p><p>print(r.content.decode())</p><p style="white-space: normal;">------------------------------</p><p>04_sina.py</p><p style="white-space: normal;">------------------------------</p><p># coding=utf-8</p><p>import requests</p><p>url =&quot;http://www.sina.com&quot;</p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&quot;}</p><p><br/></p><p>r = requests.get(url,headers=headers)</p><p># print(r.text)</p><p>print(r.content.decode())</p><p style="white-space: normal;">------------------------------</p><p>05_baidufanyi.py</p><p style="white-space: normal;">------------------------------</p><p>import requests</p><p>import json</p><p>import random</p><p>import hashlib</p><p><br/></p><p># 1.准备好url，post data</p><p>post_url = &quot;http://api.fanyi.baidu.com/api/trans/vip/translate&quot;</p><p>query_string = input(&quot;请输入要翻译的内容:&quot;)</p><p>appid = &quot;20180917000208070&quot;</p><p>appsecret = &quot;BfD6HMJ9_izyRBA61glS&quot;</p><p>salt = random.randint(1, 1)</p><p>sign = appid+query_string+str(salt)+appsecret</p><p>m1 = hashlib.md5()</p><p>m1.update(sign.encode(encoding=&#39;UTF-8&#39;))</p><p>sign = m1.hexdigest()</p><p>print(sign)</p><p>myurl = post_url+&#39;?appid=&#39;+appid+&#39;&amp;q=&#39;+query_string+&#39;&amp;from=en&#39;+&#39;&amp;to=zh&#39;+&#39;&amp;salt=&#39;+str(salt)+&#39;&amp;sign=&#39;+sign</p><p># 2.发送请求，获得数据</p><p>response = requests.get(myurl)</p><p>json_resposne = response.content.decode()&nbsp; #获取网页html字符串</p><p>print(json_resposne)</p><p># 3.提取数据</p><p>dict_response = json.loads(json_resposne) #把字符串转化为字典</p><p>ret = dict_response[&quot;trans_result&quot;][0][&quot;dst&quot;]</p><p><br/></p><p>print(&quot;{}的翻译结果是：{}&quot;.format(query_string,ret))</p><p style="white-space: normal;">------------------------------</p><p>06_session.py</p><p style="white-space: normal;">------------------------------</p><p># coding=utf-8</p><p>import requests</p><p>post_url = &quot;http://www.renren.com/PLogin.do&quot;</p><p>post_data = {&quot;email&quot;:&quot;mr_mao_hacker@163.com&quot;, &quot;password&quot;:&quot;alarmchime&quot;}</p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&quot;}</p><p><br/></p><p>session = requests.session()&nbsp; #实例化一个seesion</p><p>session.post(post_url,data=post_data,headers=headers)&nbsp; #使用session发送post请求，并且把登陆后的cookies保存在session里面</p><p><br/></p><p>#继续使用前一次带有cookies的session请求必须登录才能访问的页面</p><p>response = session.get(&quot;http://www.renren.com/327550029/profile&quot;,headers=headers)</p><p><br/></p><p>f = open(&quot;renren.html&quot;,&quot;w&quot;,encoding=&quot;utf-8&quot;)</p><p>f.write(response.content.decode())</p><p>f.close()</p><p style="white-space: normal;">------------------------------</p><p>07_cookies.py</p><p style="white-space: normal;">------------------------------</p><p>import requests</p><p>post_url = &quot;http://www.renren.com/PLogin.do&quot;</p><p>post_data = {&quot;email&quot;:&quot;mr_mao_hacker@163.com&quot;, &quot;password&quot;:&quot;alarmchime&quot;}</p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;Cookie&quot;:&quot;anonymid=j3jxk555-nrn0wh; _r01_=1; JSESSIONID=abcX04wUgB28nc3au698v; depovince=BJ; _uij=JTdCJTIydXNlcklkJTIyJTNBMzI3NTUwMDI5JTJDJTIydXNlck5hbWUlMjIlM0ElMjIlRTYlQUYlOUIlRTUlODUlODYlRTUlODYlOUIlMjIlMkMlMjJoZWFkRnVsbFVybCUyMiUzQSUyMmh0dHAlM0ElMkYlMkZoZG4ueG5pbWcuY24lMkZwaG90b3MlMkZoZG4zMjElMkYyMDE3MTAxMCUyRjE2MTUlMkZoZWFkX01uUFBfYzk3NTAwMDA4NGZlMTk4Ni5qcGclMjIlMkMlMjJnZW5kZXIlMjIlM0ElMjIlRTclOTQlQjclRTclOTQlOUYlMjIlMkMlMjJsb2dDb3VudCUyMiUzQTIzMyUyQyUyMmNvZGUlMjIlM0EwJTdE; renrenuid=327550029; _ga=GA1.2.1274811859.1497951251; _gid=GA1.2.425390350.1509330131; ch_id=10016; jebecookies=355a2bd2-ff48-4ca7-849d-0cfa70d01373|||||; ick_login=bb62b795-7cc8-4fed-851e-bdb8552a0f2f; _de=BF09EE3A28DED52E6B65F6A4705D973F1383380866D39FF5; p=456b02be83f0342ca2f81410a5feb0fa9; first_login_flag=1; ln_uact=mr_mao_hacker@163.com; ln_hurl=http://hdn.xnimg.cn/photos/hdn321/20171010/1615/main_MnPP_c975000084fe1986.jpg; t=59278a421bf091324fd085192873a61c9; societyguester=59278a421bf091324fd085192873a61c9; id=327550029; xnsid=929e661c; loginfrom=syshome; wp_fold=0&quot;}</p><p><br/></p><p><br/></p><p>#继续使用前一次带有cookies的session请求必须登录才能访问的页面</p><p>response = requests.get(&quot;http://www.renren.com/327550029/profile&quot;,headers=headers)</p><p><br/></p><p>f = open(&quot;renren.html&quot;,&quot;w&quot;,encoding=&quot;utf-8&quot;)</p><p>f.write(response.content.decode())</p><p>f.close()</p><p style="white-space: normal;">------------------------------</p><p>parse.py</p><p style="white-space: normal;">------------------------------</p><p>import requests</p><p>from retrying import retry</p><p>headers = {&quot;User-Agent&quot;:&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&quot;}</p><p><br/></p><p>@retry(stop_max_attempt_number=3)</p><p>def _parse_url(url):&nbsp; #专门的发送请求</p><p>&nbsp; &nbsp; print(&quot;*&quot;*50)</p><p>&nbsp; &nbsp; response = requests.get(url,headers=headers,timeout=3)</p><p>&nbsp; &nbsp; assert response.status_code == 200 #assert断言，断言失败会报错</p><p>&nbsp; &nbsp; return response.content.decode()</p><p><br/></p><p>def parse_url(url):</p><p>&nbsp; &nbsp; try:&nbsp; #异常捕获</p><p>&nbsp; &nbsp; &nbsp; &nbsp; html_str = _parse_url(url)&nbsp; #调用之前的_parse_url的方法</p><p>&nbsp; &nbsp; except:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; html_str = None&nbsp; #如果异常了，就让html_str=None</p><p>&nbsp; &nbsp; return html_str</p><p><br/></p><p>if __name__ == &#39;__main__&#39;:</p><p>&nbsp; &nbsp; url = &quot;http://www.baidu.com&quot;</p><p>&nbsp; &nbsp; url1 = &quot;www.baidu.com&quot;</p><p>&nbsp; &nbsp; html_str = parse_url(url1)</p><p>&nbsp; &nbsp; if html_str is not None:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(html_str[:500])</p><p>&nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;error&quot;)</p><p style="white-space: normal;">------------------------------</p><p>请同学们参考练习，务必亲自敲代码，脚踏实地的编程！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/45.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=45</wfw:commentRss></item><item><title>python暑期专业实训-Day03代码参考</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/44.html</link><pubDate>Sun, 16 Sep 2018 22:06:52 +0800</pubDate><guid>http://gaohualing.cn/post/44.html</guid><description><![CDATA[<p>01_cat.py</p><p>-----------------------------</p><p><br/></p><p>class Cat:</p><p>&nbsp; &nbsp; def eat(self):&nbsp; #实例方法&nbsp; &nbsp;self就是指最终的实例</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;猫在吃肉...&quot;)</p><p><br/></p><p>&nbsp; &nbsp; def drink(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;猫在喝可乐...&quot;)</p><p><br/></p><p>if __name__ == &quot;__main__&quot;:</p><p>&nbsp; &nbsp; my_cat = Cat()&nbsp; &nbsp; #实例化</p><p>&nbsp; &nbsp; my_cat.eat()</p><p>&nbsp; &nbsp; my_cat.drink()</p><p>-----------------------------</p><p>02_cat1.py</p><p style="white-space: normal;">-----------------------------</p><p>class Cat:</p><p>&nbsp; &nbsp; def __init__(self,name,color):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; # print(&quot;cat正在实例化&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; self.cat_name = name</p><p>&nbsp; &nbsp; &nbsp; &nbsp; self.cat_color = color</p><p>&nbsp; &nbsp; &nbsp; &nbsp; self.cat_age = 3</p><p>&nbsp; &nbsp; &nbsp; &nbsp; # self.eat()&nbsp; #eat方法想在初始化，实例化的时候调用</p><p><br/></p><p>&nbsp; &nbsp; def eat(self):&nbsp; # 实例方法&nbsp; &nbsp;self就是指最终的实例</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;我的{}在吃肉...,他的毛是{}&quot;.format(self.cat_name,self.cat_color))</p><p>&nbsp; &nbsp; &nbsp; &nbsp; c = self.drink(&quot;牛奶&quot;)</p><p><br/></p><p>&nbsp; &nbsp; def drink(self,drinks):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;我的{}岁的{}在喝{}...&quot;.format(self.cat_age,self.cat_name,drinks))</p><p>&nbsp; &nbsp; &nbsp; &nbsp; alive = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return alive</p><p><br/></p><p>if __name__ == &quot;__main__&quot;:</p><p>&nbsp; &nbsp; my_cat = Cat(&quot;大黄&quot;,&quot;黄色&quot;)&nbsp; # 实例化</p><p>&nbsp; &nbsp; print(my_cat.cat_name,my_cat.cat_age)</p><p>&nbsp; &nbsp; a = my_cat.eat()</p><p>&nbsp; &nbsp; print(&quot;a is&quot;,a)</p><p>&nbsp; &nbsp; is_alive = my_cat.drink(&quot;果粒橙&quot;)</p><p>&nbsp; &nbsp; if is_alive:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;我的猫还活着&quot;)</p><p>&nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;我的猫不活了&quot;)</p><p style="white-space: normal;">-----------------------------</p><p>03_try1.py</p><p style="white-space: normal;">-----------------------------</p><p>def add_fun(x,y):</p><p>&nbsp; &nbsp; try:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; sum = x+y</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;结果是:&quot;,sum)</p><p>&nbsp; &nbsp; # except Exception as e:</p><p>&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp;print(e)</p><p>&nbsp; &nbsp; except:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;输入有误，请重新输入&quot;)</p><p><br/></p><p><br/></p><p>if __name__ == &#39;__main__&#39;:</p><p>&nbsp; &nbsp; add_fun(&quot;123&quot;,2)</p><p>&nbsp; &nbsp; add_fun(4,2)</p><p style="white-space: normal;">-----------------------------</p><p>04_student_sys_class.py</p><p style="white-space: normal;">-----------------------------</p><p>class StudentSystem:</p><p>&nbsp; &nbsp; def __init__(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; self.student_list = [{&quot;name&quot;: &quot;xiaohong&quot;, &quot;age&quot;: 20, &quot;stu_num&quot;: 10000}]</p><p><br/></p><p>&nbsp; &nbsp; def print_info(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;*&quot; * 20)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;欢迎来到学生信息管理系统&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;1.展示全部学生&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;2.搜索一个学生&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;3.增加一个学生&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;4.修改一个学生&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;5.删除一个学生&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;6.退出信息系统&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;*&quot; * 20)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; user_input = input(&quot;&gt;&gt;&gt;&gt;请选择序号:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return user_input</p><p><br/></p><p>&nbsp; &nbsp; def show_all_student_info(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; for stu in self.student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(stu)</p><p><br/></p><p>&nbsp; &nbsp; def search_student(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; search_student_name = input(&quot;请输入要搜索的学生姓名:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; &nbsp; &nbsp; for stu in self.student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == search_student_name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(stu)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if not stu_exist:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&gt;&gt;&gt;您要查找的学生不存在&quot;)</p><p><br/></p><p>&nbsp; &nbsp; def add_student_info(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; name = input(&quot;请输入要增加的学生姓名:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; age = input(&quot;请输入要增加的学生年龄:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; stu_num = input(&quot;请输入要增加的学生学号:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; new_student = {&quot;name&quot;: name, &quot;age&quot;: age, &quot;stu_num&quot;: stu_num}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; self.student_list.append(new_student)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;新的学生[{}]添加成功&quot;.format(name))</p><p><br/></p><p>&nbsp; &nbsp; def delete_student_info(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; name = input(&quot;请输入要删除的学生姓名:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; &nbsp; &nbsp; for stu in self.student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.student_list.remove(stu)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;您要删除的学生[{}]已经删除成功&quot;.format(name))</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if not stu_exist:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;您要删除的[{}]不存在&quot;.format(name))</p><p><br/></p><p>&nbsp; &nbsp; def modify_student_info(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; name = input(&quot;请输入要修改的学生姓名:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; &nbsp; &nbsp; for stu in self.student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu[&quot;age&quot;] = input(&quot;请输入修改后的年龄:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu[&quot;stu_num&quot;] = input(&quot;请输入修改后的学号:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;您要修改的[{}]已经修改成功&quot;.format(name))</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if not stu_exist:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;您要修改的[{}]不存在&quot;.format(name))</p><p><br/></p><p>&nbsp; &nbsp; def main(self):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; while True:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 1.提示信息，让用户输入</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user_input = self.print_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.判断用户输入</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if user_input in [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;]:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.1用户选择查看所有</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if user_input == &quot;1&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.show_all_student_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.2用户选择搜索学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;2&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.search_student()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.3用户选择增加学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;3&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.add_student_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.4用户选择删除学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;5&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.delete_student_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.5用户选择修改学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;4&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.modify_student_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 2.6选择退出</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;6&quot;:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;欢迎下次再来。。。&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;》》》输入有误，请重新选择&quot;)</p><p><br/></p><p><br/></p><p>if __name__ == &#39;__main__&#39;:</p><p>&nbsp; &nbsp; studetn_system = StudentSystem()</p><p>&nbsp; &nbsp; studetn_system.main()</p><p style="white-space: normal;">-----------------------------</p><p>请同学们参考练习，务必亲自敲代码，脚踏实地的编程！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/44.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=44</wfw:commentRss></item><item><title>python暑期专业实训-Day02代码参考</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/43.html</link><pubDate>Sun, 16 Sep 2018 21:41:41 +0800</pubDate><guid>http://gaohualing.cn/post/43.html</guid><description><![CDATA[<p>00_year.py</p><p>-------------------------------------</p><p><br/></p><p>#1.输入一个年份</p><p>#2.判断是否为闰年</p><p>&nbsp; &nbsp; #2.1. 条件1</p><p>&nbsp; &nbsp; #2.2&nbsp; 条件2</p><p><br/></p><p>#and 表示并且&nbsp; Fasle and True</p><p>#or 表示或者&nbsp; Fasle or True</p><p>#!= 表示不等于</p><p>def year(a):</p><p>&nbsp; &nbsp; if a%4==0 and a%100 != 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;{}是闰年&quot;.format(a))</p><p>&nbsp; &nbsp; elif a%400 == 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;{}是闰年&quot;.format(a))</p><p>&nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;{}不是闰年&quot;.format(a))</p><p><br/></p><p>def year1(a):</p><p>&nbsp; &nbsp; if a%4==0 and a%100 != 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;{}是闰年&quot;.format(a))</p><p>&nbsp; &nbsp; if a%400 == 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;{}是闰年&quot;.format(a))</p><p><br/></p><p><br/></p><p>year1(1956)</p><p>-------------------------------------</p><p>01_student_system.py</p><p style="white-space: normal;">-------------------------------------</p><p>#1.学生信息保存在字典里面</p><p>#2.所有的学生信息放在列表中</p><p><br/></p><p>#while True</p><p>&nbsp; &nbsp; #3.打印提示</p><p>&nbsp; &nbsp; #4.用户输入</p><p>&nbsp; &nbsp; #5.拿到用户输入的结果</p><p>&nbsp; &nbsp; #6.根据结果选择要做的事情，即选择要调用的函数</p><p>&nbsp; &nbsp; &nbsp; &nbsp; #函数1.展示全部学生信息</p><p>&nbsp; &nbsp; &nbsp; &nbsp; #函数2.搜索一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; #函数3.增加一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; #函数4.修改一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; #函数5.删除一个学生</p><p>&nbsp; &nbsp; #7.用户退出，break</p><p><br/></p><p>student_list = [{&quot;name&quot;:&quot;xiaohong&quot;,&quot;age&quot;:18,&quot;stu_num&quot;:10000}]</p><p><br/></p><p>def print_info():</p><p>&nbsp; &nbsp; print(&quot;*&quot;*20)&nbsp; #3.打印提示</p><p>&nbsp; &nbsp; print(&quot;欢迎来到学生信息管理系统&quot;)</p><p>&nbsp; &nbsp; print(&quot;1.展示全部学生&quot;)</p><p>&nbsp; &nbsp; print(&quot;2.搜索一个学生&quot;)</p><p>&nbsp; &nbsp; print(&quot;3.增加一个学生&quot;)</p><p>&nbsp; &nbsp; print(&quot;4.修改一个学生&quot;)</p><p>&nbsp; &nbsp; print(&quot;5.删除一个学生&quot;)</p><p>&nbsp; &nbsp; print(&quot;6.退出信息系统&quot;)</p><p>&nbsp; &nbsp; print(&quot;*&quot;*20)</p><p>&nbsp; &nbsp; user_input = input(&quot;&gt;&gt;&gt;&gt;请选择序号:&quot;) #4.用户输入</p><p>&nbsp; &nbsp; return user_input</p><p><br/></p><p>def show_all_stu(): #展示所有的学生</p><p>&nbsp; &nbsp; for stu in student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(stu)</p><p><br/></p><p>def search_stu(): #搜索学生</p><p>&nbsp; &nbsp; user_input_name = input(&quot;&gt;&gt;&gt;&gt;请输入学生的名字：&quot;)</p><p>&nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; for stu in student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == user_input_name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True&nbsp; #如果学生存在，就让stu_exist变为True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(stu)</p><p>&nbsp; &nbsp; if stu_exist == False:#&nbsp; if not stu_exist&nbsp; #if stu_exist !=True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&gt;&gt;&gt;&gt;您要搜索的学生不存在&quot;)</p><p><br/></p><p>def add_stu():</p><p>&nbsp; &nbsp; stu_name = input(&quot;请输入要添加的学生姓名:&quot;)</p><p>&nbsp; &nbsp; stu_age = input(&quot;请输入要添加的学生年龄:&quot;)</p><p>&nbsp; &nbsp; stu_num = input(&quot;请输入要添加的学生学号:&quot;)</p><p>&nbsp; &nbsp; new_stu = {&quot;name&quot;:stu_name,&quot;age&quot;:stu_age,&quot;stu_num&quot;:stu_num}</p><p>&nbsp; &nbsp; student_list.append(new_stu)</p><p>&nbsp; &nbsp; print(&quot;学生:{}信息添加成功&quot;.format(stu_name))</p><p><br/></p><p>def modify_stu_info():</p><p>&nbsp; &nbsp; stu_name = input(&quot;请输入要修改的学生姓名:&quot;)</p><p>&nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; for stu in student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == stu_name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_age = input(&quot;请输入修改后的年龄:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_num = input(&quot;亲输入修改后的学号:&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu[&quot;age&quot;] = stu_age</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu[&quot;stu_num&quot;] = stu_num</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;学生:{}信息更新成功&quot;.format(stu_name))</p><p>&nbsp; &nbsp; if not stu_exist:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&gt;&gt;&gt;&gt;您要修改的学生不存在&quot;)</p><p><br/></p><p>def delete_stu_info():</p><p>&nbsp; &nbsp; stu_name = input(&quot;请输入要删除的学生姓名:&quot;)</p><p>&nbsp; &nbsp; stu_exist = False</p><p>&nbsp; &nbsp; for stu in student_list:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if stu[&quot;name&quot;] == stu_name:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu_exist = True</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; student_list.remove(stu)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;学生:{}信息删除成功&quot;.format(stu_name))</p><p>&nbsp; &nbsp; if not stu_exist:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&gt;&gt;&gt;&gt;您要删除的学生不存在&quot;)</p><p><br/></p><p>def main():</p><p>&nbsp; &nbsp; while True:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; user_input = print_info()&nbsp; #5.拿到用户输入的结果</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if user_input&nbsp; in [&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;]:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # print(user_input)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if user_input == &quot;1&quot;:&nbsp; #展示所有的学生信息</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; show_all_stu()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;2&quot;: #搜索一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_stu()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;3&quot;: #增加一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add_stu()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;4&quot;: #修改一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modify_stu_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;5&quot;: #删除一个学生</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delete_stu_info()</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif user_input == &quot;6&quot;: #退出</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&gt;&gt;&gt;&gt;再见&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break</p><p>&nbsp; &nbsp; &nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&quot;不好意思，你输入错误，请重新输入&quot;)</p><p><br/></p><p>if __name__ == &quot;__main__&quot;:</p><p>&nbsp; &nbsp; main()</p><p style="white-space: normal;">-------------------------------------</p><p>02_if.py</p><p style="white-space: normal;">-------------------------------------</p><p>money = input(&quot;请输入你口袋里的钱：&quot;)</p><p><br/></p><p>money = int(money)</p><p><br/></p><p>if money&gt;25:&nbsp; #money&gt;25的时候执行里面的内容</p><p>&nbsp; &nbsp; print(&quot;今晚吃鸡&quot;)</p><p><br/></p><p>if 10&lt;money &lt;=25: #money大于10小于等于25的时候执行内部的语句</p><p>&nbsp; &nbsp; print(&quot;吃鱼&quot;)</p><p>&nbsp; &nbsp; print(&quot;1&quot;)</p><p><br/></p><p>print(&quot;2&quot;)&nbsp; #注意语法，什么叫做在叫做在if内部，什么不在</p><p><br/></p><p>if 0&lt;money&lt;=21:&nbsp; #money大于0小于等于21的时执行里面的语句</p><p>&nbsp; &nbsp; print(&quot;吃蔬菜&quot;)</p><p><br/></p><p>if money == 0:&nbsp; &nbsp;#money等于0的时候执行其中的语句</p><p>&nbsp; &nbsp; print(&quot;不吃&quot;)</p><p style="white-space: normal;">-------------------------------------</p><p>02_open_file.py</p><p style="white-space: normal;">-------------------------------------</p><p>f = open(&quot;function1.py&quot;,&quot;r&quot;)</p><p>content = f.read()</p><p>f.close()</p><p><br/></p><p>print(content)</p><p style="white-space: normal;">-------------------------------------</p><p>02_write_file.py</p><p style="white-space: normal;">-------------------------------------</p><p>f = open(&quot;a.txt&quot;,&quot;a&quot;)</p><p>f.write(&quot;hello\nworld&quot;)</p><p>f.close()</p><p style="white-space: normal;">-------------------------------------</p><p>03_if_else.py</p><p style="white-space: normal;">-------------------------------------</p><p>money = 20</p><p><br/></p><p>if money&gt;18:</p><p>&nbsp; &nbsp; print(&quot;吃饭&quot;)</p><p><br/></p><p>else:&nbsp; &nbsp;#eles不需要条件，表示其他的条件都不满足的时候就执行else其中的语句</p><p>&nbsp; &nbsp; print(&quot;吃不起&quot;)</p><p style="white-space: normal;">-------------------------------------</p><p>03_write_dict.py</p><p style="white-space: normal;">-------------------------------------</p><p>import json</p><p>a = {&quot;xiaohong&quot;:20,&quot;xiaogang&quot;:21,&quot;xiaoming&quot;:18}</p><p>str_a = json.dumps(a)</p><p>f = open(&quot;dict.txt&quot;,&quot;w&quot;)</p><p>f.write(str_a)</p><p>f.close()</p><p style="white-space: normal;">-------------------------------------</p><p>04_if_elif_elif_else.py</p><p style="white-space: normal;">-------------------------------------</p><p>money = 20</p><p><br/></p><p>if money&gt;30:</p><p>&nbsp; &nbsp; print(1)</p><p><br/></p><p>elif 20&lt;=money&lt;=30:</p><p>&nbsp; &nbsp; print(2)</p><p><br/></p><p>elif&nbsp; 10&lt;money&lt;=20:&nbsp; &nbsp;#可以有多个elif</p><p>&nbsp; &nbsp; print(3)</p><p><br/></p><p>else:&nbsp; #不需要条件，表示上面都不满足的时候执行他</p><p>&nbsp; &nbsp; print(4)</p><p style="white-space: normal;">-------------------------------------</p><p>04_read_dict.py</p><p style="white-space: normal;">-------------------------------------</p><p>import json</p><p><br/></p><p>f = open(&quot;dict.txt&quot;,&quot;r&quot;)</p><p>content = f.read()</p><p>f.close()</p><p>content = json.loads(content)</p><p>print(content)</p><p>print(type(content))</p><p style="white-space: normal;">-------------------------------------</p><p>05_for_in.py</p><p style="white-space: normal;">-------------------------------------</p><p>a = [1,2,3,4,5,6,7,8,9,10]</p><p>for i in a:&nbsp; #循环，i挨个获取a里面的内容，获取一个之后执行其中的语句，执行完了，a取下一个值</p><p>&nbsp; &nbsp; print(&quot;现在执行第{}次循环&quot;.format(i))&nbsp; &nbsp;#pep8规范</p><p><br/></p><p>print(&quot;*&quot;*10)</p><p style="white-space: normal;">-------------------------------------</p><p>05_try_json.py</p><p style="white-space: normal;">-------------------------------------</p><p>import json</p><p>temp_str = &#39;&#39;&#39;{&quot;message&quot;: &quot;success&quot;, &quot;data&quot;: {&quot;pc_feed_focus&quot;: [{&quot;title&quot;: &quot;\u6cf0\u56fd\u60bc\u5ff5\u5148\u738b\u666e\u5bc6\u84ec\u901d\u4e16\u4e00\u5468\u5e74 \u6c11\u4f17\u75db\u54ed\u6d41\u6d95\u60b2\u4f24\u4e0d\u5df2&quot;, &quot;display_url&quot;: &quot;/group/6476284682694770958/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3efc00015ef61bd59793&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476284682694770958, &quot;media_url&quot;: &quot;http://toutiao.com/m5784742177&quot;}, {&quot;title&quot;: &quot;\u5976\u7238\u5976\u5988\u548c\u201c\u6eda\u6eda\u201d\u7684\u6e29\u99a8\u65f6\u523b \u8fd9\u79cd\u6574\u5929\u88ab\u62b1\u5927\u817f\u7684\u5de5\u4f5c\u8fd8\u62db\u4eba\u5417&quot;, &quot;display_url&quot;: &quot;/group/6476661517630521613/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f0000028b49efb750fd&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476661517630521613, &quot;media_url&quot;: &quot;http://toutiao.com/m52307864703&quot;}, {&quot;title&quot;: &quot;\u738b\u529b\u5b8f\u5316\u8eab\u5341\u8db3\u5976\u7238 \u81ea\u66dd\u6bcf\u665a\u5531\u6447\u7bee\u66f2\u54c4\u5973\u513f\u5165\u7761&quot;, &quot;display_url&quot;: &quot;/group/6476596750801961486/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f0000029e48818f96b2&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476596750801961486, &quot;media_url&quot;: &quot;http://toutiao.com/m50266454509&quot;}, {&quot;title&quot;: &quot;\u82f1\u8d856\u5927\u8c6a\u5f3a\u51fa\u6218\u51b7\u95e8\u8fed\u7206 \u84dd\u519b\u8001\u53f8\u673a\u7ffb\u8f66\u67aa\u624b\u5c06\u7b2c\u56db\u62f1\u624b\u76f8\u8ba9&quot;, &quot;display_url&quot;: &quot;/group/6476823272394621197/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3e83001d1069922b1865&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476823272394621197, &quot;media_url&quot;: &quot;http://toutiao.com/m1564293928517634&quot;}, {&quot;title&quot;: &quot;\u7f8e\u56fd\u201c\u5bc6\u6b47\u6839\u201d\u6838\u6f5c\u8247\u62b5\u8fbe\u97e9\u56fd\u91dc\u5c71&quot;, &quot;display_url&quot;: &quot;/group/6476295974415253774/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f000002a53197ce328f&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476295974415253774, &quot;media_url&quot;: &quot;http://toutiao.com/m5784742177&quot;}, {&quot;title&quot;: &quot;\u738b\u4e3d\u5764\u201c\u638c\u63b4\u201d\u9ad8\u4ee5\u7fd4 \u803f\u76f4girl\u5f53\u573adiss&quot;, &quot;display_url&quot;: &quot;/group/6476378421324054798/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p1.pstatp.com/large/3eff0002ddd80c819c3d&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6476378421324054798, &quot;media_url&quot;: &quot;http://toutiao.com/m50092288407&quot;}, {&quot;title&quot;: &quot;Selina\u59b9\u59b9\u4efb\u5bb9\u8431\u8981\u5f53\u5317\u6f02\uff0c\u5979\u7684\u5185\u5fc3\u4f4f\u7740\u4e00\u53ea\u201c\u5c0f\u91ce\u517d\u201d\u4e28\u4e13\u8bbf&quot;, &quot;display_url&quot;: &quot;/group/6475216013678871054/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f000000303ddc1dac0f&quot;, &quot;has_image&quot;: false, &quot;group_id&quot;: 6475216013678871054, &quot;media_url&quot;: &quot;http://toutiao.com/m50266454509&quot;}, {&quot;title&quot;: &quot;\u4e2d\u56fd\u9996\u6b21\u66dd\u5149\u6b7c15\u8230\u8f7d\u673a\uff1a\u4f7f\u7528\u56fd\u4ea7\u7535\u78c1\u5f39\u5c04\u5668\u8d77\u98de\u6210\u529f&quot;, &quot;display_url&quot;: &quot;/group/6475921837753631246/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3efd0008478ac3f4d442&quot;, &quot;has_image&quot;: false, &quot;group_id&quot;: 6475921837753631246, &quot;media_url&quot;: &quot;http://toutiao.com/m4087561186&quot;}, {&quot;title&quot;: &quot;\u6700\u5f3a\u7ae5\u989c\u5f20\u5a1c\u62c9\u4e0a\u7ebf \u643a\u624b\u5b59\u6d69\u4fca\u751c\u871c\u6c14\u6c1b\u6ea2\u51fa\u5c4f\u5e55~&quot;, &quot;display_url&quot;: &quot;/group/6475921668145938702/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p9.pstatp.com/origin/3efd00084767b74b0980&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6475921668145938702, &quot;media_url&quot;: &quot;http://toutiao.com/m5738017030&quot;}, {&quot;title&quot;: &quot;E\u795e\u9a7e\u5230\uff01\u9648\u5955\u8fc5\u65b0\u6b4c\u97f3\u4e50\u4f1a\u5fc3\u60c5\u7206\u597d\uff0c\u624b\u821e\u8db3\u8e48\u641e\u602a\u4e0d\u505c~&quot;, &quot;display_url&quot;: &quot;/group/6475901594457080077/&quot;, &quot;has_video&quot;: false, &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3e8200187999129ae0cd&quot;, &quot;has_image&quot;: true, &quot;group_id&quot;: 6475901594457080077, &quot;media_url&quot;: &quot;http://toutiao.com/m5738017030&quot;}]}}&#39;&#39;&#39;</p><p>temp_dict = json.loads(temp_str)</p><p># print(temp_dict)</p><p><br/></p><p>#希望把temp_dict写入本地</p><p>f = open(&quot;touitao.txt&quot;,&quot;w&quot;,encoding=&quot;utf-8&quot;)</p><p>f.write(json.dumps(temp_dict,ensure_ascii=False,indent=2))</p><p>f.close()</p><p style="white-space: normal;">-------------------------------------</p><p>06_range.py</p><p style="white-space: normal;">-------------------------------------</p><p># my_list = range(100)&nbsp; #生成一个包含0-99的100个数字的可迭代对象，可以使用for in 循环遍历</p><p>my_list = list(range(100))&nbsp; &nbsp;#编程一个列表</p><p><br/></p><p>for i in my_list:</p><p>&nbsp; &nbsp; print(&quot;当前的i是{}&quot;.format(i))</p><p style="white-space: normal;">-------------------------------------</p><p>07_while.py</p><p style="white-space: normal;">-------------------------------------</p><p><br/></p><p>number_a = 1</p><p>while number_a&lt;10:&nbsp; #while后面接条件，表什么时候里面的内容执行，什么时候不执行</p><p>&nbsp; &nbsp; print(&quot;当前a是{}&quot;.format(number_a))</p><p>&nbsp; &nbsp; # number_a = number_a+1</p><p>&nbsp; &nbsp; number_a += 1&nbsp; #当前一行和上一行的相同，意思相同</p><p><br/></p><p>print(&quot;程序结束&quot;)</p><p style="white-space: normal;">-------------------------------------</p><p>08_odd.py</p><p style="white-space: normal;">-------------------------------------</p><p>a = 1</p><p>sum = 0&nbsp; #和最开始的为0</p><p>while a&lt;=100:</p><p>&nbsp; &nbsp; if a%2==0:&nbsp; #判断a是否为偶数</p><p>&nbsp; &nbsp; &nbsp; &nbsp; sum = sum+a #用和加上每一个偶数</p><p>&nbsp; &nbsp; a = a+1&nbsp; #让a加上1</p><p><br/></p><p>print(&quot;sum为{}&quot;.format(sum))</p><p style="white-space: normal;">-------------------------------------</p><p>09_sum100.py</p><p style="white-space: normal;">-------------------------------------</p><p>a = 1</p><p>sum = 0</p><p>while a&lt;=100:</p><p>&nbsp; &nbsp; if sum&gt;100:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break&nbsp; #当sum大于100的时候，后面的循环就不在执行了</p><p>&nbsp; &nbsp; sum = sum+a</p><p>&nbsp; &nbsp; # if sum&gt;100:</p><p>&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp;break</p><p>&nbsp; &nbsp; a = a+1</p><p><br/></p><p><br/></p><p><br/></p><p>print(&quot;1-100中前n个数的和刚好大于100的第一个数是{}&quot;.format(sum))</p><p><br/></p><p><br/></p><p>for i in range(100):</p><p>&nbsp; &nbsp; if i&gt;10:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break&nbsp; #i大于10的时候，停止循环</p><p>&nbsp; &nbsp; print(i)</p><p><br/></p><p>for i in rage(10):&nbsp; #当前prin(i)是不会有任何的现象的，第一次就break了</p><p>&nbsp; &nbsp; break</p><p>&nbsp; &nbsp; print(i)</p><p style="white-space: normal;">-------------------------------------</p><p>10_continue.py</p><p style="white-space: normal;">-------------------------------------</p><p>for i in range(10):</p><p>&nbsp; &nbsp; if i == 5:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; continue&nbsp; #跳出了i=5的这次的循环，继续选择i=6的结果</p><p>&nbsp; &nbsp; print(i)</p><p style="white-space: normal;">-------------------------------------</p><p>11_even_sum.py</p><p style="white-space: normal;">-------------------------------------</p><p>sum = 0</p><p>for i in range(1,101):</p><p>&nbsp; &nbsp; if i%2 == 0: #当前的条件成立表示i是偶数</p><p>&nbsp; &nbsp; &nbsp; &nbsp; continue</p><p>&nbsp; &nbsp; print(i)</p><p>&nbsp; &nbsp; sum = sum + i</p><p><br/></p><p>print(&quot;1-100内的所有的奇数的和市{}&quot;.format(sum))</p><p style="white-space: normal;">-------------------------------------</p><p>12_try_def.py</p><p style="white-space: normal;">-------------------------------------</p><p>def print_helloworld():&nbsp; #定义一个函数，需要有def关键字，函数名，（）和冒号，换行后下面的内容是函数体</p><p>&nbsp; &nbsp; print(&quot;hello,world&quot;)</p><p>&nbsp; &nbsp; print(&quot;are you ok&quot;)</p><p><br/></p><p># print_helloworld()</p><p># print_helloworld()</p><p>for i in range(100):</p><p>&nbsp; &nbsp; print_helloworld()</p><p style="white-space: normal;">-------------------------------------</p><p>13_try_def_2.py</p><p style="white-space: normal;">-------------------------------------</p><p>def print_my_word(a): #带一个参数的函数</p><p>&nbsp; &nbsp; print(&quot;this is {}&quot;.format(a))</p><p><br/></p><p>print_my_word(&quot;ARE YOU OK&quot;)</p><p>print_my_word([&quot;1&quot;,&quot;2&quot;])</p><p style="white-space: normal;">-------------------------------------</p><p>14_get_volume.py</p><p style="white-space: normal;">-------------------------------------</p><p>def get_volume(a):</p><p>&nbsp; &nbsp; # print(&quot;正方体边长为{}的体积为:&quot;.format(a),a*a*a)</p><p>&nbsp; &nbsp; print(&quot;正方体边长为{}的体积为:{}&quot;.format(a,a*a*a))</p><p><br/></p><p><br/></p><p>def get_volume2(a,b,c):&nbsp; #长方体的体积 #带多个参数的函数</p><p>&nbsp; &nbsp; print(&quot;长方体边长分别为{}，{}，{}的体积为:{}&quot;.format(a,b,c,a*b*c))</p><p><br/></p><p>c = get_volume(10)&nbsp; #c为调用这个函数的结果，但是当前函数并没有任何的结果，所以c为None</p><p>print(c)</p><p>get_volume2(10,20,30)</p><p style="white-space: normal;">-------------------------------------</p><p>15_get_volume2.py</p><p style="white-space: normal;">-------------------------------------</p><p>def get_volume(a):</p><p>&nbsp; &nbsp; # print(&quot;正方体边长为{}的体积为:&quot;.format(a),a*a*a)</p><p>&nbsp; &nbsp; v1 = a*a*a</p><p>&nbsp; &nbsp; print(&quot;正方体边长为{}的体积为:{}&quot;.format(a,v1))</p><p>&nbsp; &nbsp; return v1&nbsp; #有返回值的函数</p><p><br/></p><p><br/></p><p>def get_volume2(a,b,c):&nbsp; #长方体的体积</p><p>&nbsp; &nbsp; v2 = a*b*c</p><p>&nbsp; &nbsp; v3 = v2+100</p><p>&nbsp; &nbsp; print(&quot;长方体边长分别为{}，{}，{}的体积为:{}&quot;.format(a,b,c,v2))</p><p>&nbsp; &nbsp; return v2,v3&nbsp; #遇到return，return后面的程序都不会在执行&nbsp; #有多个返回值的函数</p><p>&nbsp; &nbsp; # return v3</p><p>&nbsp; &nbsp; # print(&quot;*&quot;*100)</p><p><br/></p><p>v1 = get_volume(100)</p><p>print(v1)</p><p>v2,v3 = get_volume2(10,20,30)</p><p>print(v2,v3)</p><p><br/></p><p>if v1&gt;v2:</p><p>&nbsp; &nbsp; print(&quot;正方体的体积大&quot;)</p><p>elif v1&lt;v2:</p><p>&nbsp; &nbsp; print(&quot;长方体的体积大&quot;)</p><p>else:</p><p>&nbsp; &nbsp; print(&quot;两个体积相等&quot;)</p><p style="white-space: normal;">-------------------------------------</p><p>16_temp.py</p><p style="white-space: normal;">-------------------------------------</p><p>def func():</p><p>&nbsp; &nbsp; for i in range(3):</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return i</p><p><br/></p><p>def func2():</p><p>&nbsp; &nbsp; d = func()&nbsp; #函数的嵌套调用</p><p>&nbsp; &nbsp; print(d)</p><p><br/></p><p># d = func()</p><p># print(d)</p><p>func2()</p><p style="white-space: normal;">-------------------------------------</p><p>17_gobal_v.py</p><p style="white-space: normal;">-------------------------------------</p><p>a = 100</p><p><br/></p><p>def test1():</p><p>&nbsp; &nbsp; a = 200 #定义了一个局部变量a=200，没有修改全局变量a</p><p>&nbsp; &nbsp; print(&quot;局部变量a的值是&quot;,a)</p><p><br/></p><p>def test2():&nbsp; #修改全局变量a =300</p><p>&nbsp; &nbsp; global a&nbsp; #声明a是一个全局变量</p><p>&nbsp; &nbsp; print(&quot;修改之前a是&quot;,a)</p><p>&nbsp; &nbsp; a = 300</p><p>&nbsp; &nbsp; print(&quot;修改之前a是&quot;,a)</p><p><br/></p><p>def test3():</p><p>&nbsp; &nbsp; print(&quot;这是test3函数，a是&quot;,a)</p><p><br/></p><p>test1()</p><p>test2()</p><p>test3()</p><p><br/></p><p>#只有在函数中才有全局变量局部变量一说，这里的j，在下一个循环中就是之前的j的值</p><p>for i in range(100):</p><p>&nbsp; &nbsp; j = i</p><p>&nbsp; &nbsp; # print(i)</p><p><br/></p><p>for i in range(3):</p><p>&nbsp; &nbsp; print(&quot;this is j&quot;,j)</p><p>&nbsp; &nbsp; print(i)</p><p style="white-space: normal;">-------------------------------------</p><p>a.txt</p><p style="white-space: normal;">-------------------------------------</p><p>hello</p><p>worldhello</p><p>world</p><p style="white-space: normal;">-------------------------------------</p><p>dict.txt</p><p style="white-space: normal;">-------------------------------------</p><p style="white-space: normal;">{&quot;xiaohong&quot;: 20, &quot;xiaogang&quot;: 21, &quot;xiaoming&quot;: 18}</p><p style="white-space: normal;">-------------------------------------</p><p>function1.py</p><p style="white-space: normal;">-------------------------------------</p><p><br/></p><p>def my_func():</p><p>&nbsp; &nbsp; print(&quot;hello,world!&quot;)</p><p><br/></p><p>if __name__ == &quot;__main__&quot;:</p><p>&nbsp; &nbsp; print(&quot;this is function1...&quot;)</p><p style="white-space: normal;">-------------------------------------</p><p>temp1.py</p><p style="white-space: normal;">-------------------------------------</p><p># import function1</p><p>from function1 import my_func</p><p><br/></p><p># function1.my_func()</p><p>my_func()</p><p style="white-space: normal;">-------------------------------------</p><p>touitao.txt</p><p style="white-space: normal;">-------------------------------------</p><p>{</p><p>&nbsp; &quot;message&quot;: &quot;success&quot;,</p><p>&nbsp; &quot;data&quot;: {</p><p>&nbsp; &nbsp; &quot;pc_feed_focus&quot;: [</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;泰国悼念先王普密蓬逝世一周年 民众痛哭流涕悲伤不已&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476284682694770958/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3efc00015ef61bd59793&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476284682694770958,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m5784742177&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;奶爸奶妈和“滚滚”的温馨时刻 这种整天被抱大腿的工作还招人吗&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476661517630521613/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f0000028b49efb750fd&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476661517630521613,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m52307864703&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;王力宏化身十足奶爸 自曝每晚唱摇篮曲哄女儿入睡&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476596750801961486/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f0000029e48818f96b2&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476596750801961486,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m50266454509&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;英超6大豪强出战冷门迭爆 蓝军老司机翻车枪手将第四拱手相让&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476823272394621197/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3e83001d1069922b1865&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476823272394621197,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m1564293928517634&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;美国“密歇根”核潜艇抵达韩国釜山&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476295974415253774/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f000002a53197ce328f&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476295974415253774,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m5784742177&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;王丽坤“掌掴”高以翔 耿直girl当场diss&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6476378421324054798/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p1.pstatp.com/large/3eff0002ddd80c819c3d&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6476378421324054798,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m50092288407&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;Selina妹妹任容萱要当北漂，她的内心住着一只“小野兽”丨专访&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6475216013678871054/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3f000000303ddc1dac0f&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6475216013678871054,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m50266454509&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;中国首次曝光歼15舰载机：使用国产电磁弹射器起飞成功&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6475921837753631246/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3efd0008478ac3f4d442&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6475921837753631246,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m4087561186&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;最强童颜张娜拉上线 携手孙浩俊甜蜜气氛溢出屏幕~&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6475921668145938702/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p9.pstatp.com/origin/3efd00084767b74b0980&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6475921668145938702,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m5738017030&quot;</p><p>&nbsp; &nbsp; &nbsp; },</p><p>&nbsp; &nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;title&quot;: &quot;E神驾到！陈奕迅新歌音乐会心情爆好，手舞足蹈搞怪不停~&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;display_url&quot;: &quot;/group/6475901594457080077/&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_video&quot;: false,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;image_url&quot;: &quot;//p3.pstatp.com/origin/3e8200187999129ae0cd&quot;,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;has_image&quot;: true,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;group_id&quot;: 6475901594457080077,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &quot;media_url&quot;: &quot;http://toutiao.com/m5738017030&quot;</p><p>&nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ]</p><p>&nbsp; }</p><p>}</p><p style="white-space: normal;">-------------------------------------</p><p>请同学们参考练习，务必亲自敲代码，脚踏实地的编程！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/43.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=43</wfw:commentRss></item><item><title>python暑期专业实训-Day01代码参考</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/42.html</link><pubDate>Sun, 16 Sep 2018 21:26:26 +0800</pubDate><guid>http://gaohualing.cn/post/42.html</guid><description><![CDATA[<p>01_temp.py</p><p>-----------------------------</p><p>print(2+3)</p><p>print(2*3)</p><p>print(3/2)</p><p>print(&quot;hello world!&quot;)</p><p>---------------------------------</p><p>02_output_and_input.py</p><p>-------------------------------</p><p>name=input(&quot;请输入一个名字：&quot;)</p><p>print(name,&quot;，你吃饭了吗？&quot;)</p><p>print(&quot;我想邀请你一起学习。&quot;)</p><p>--------------------------------</p><p>03_varible.py</p><p>--------------------------------</p><p>a = 5</p><p>a = 2</p><p>a = &quot;Hello!&quot;</p><p>print(a)</p><p>----------------------------------</p><p>04_temp.py</p><p>-----------------------------------</p><p>a = 10 #把10传给a</p><p>b = a*5 #把a*5的结果传给b</p><p>#b=50</p><p>print(&quot;结果是：&quot;,b) #输出结果，pycharm中注释快捷键CTRL+/</p><p>----------------------------------------</p><p>05_int.py</p><p>-----------------------------------</p><p>a = 23</p><p>#a = 0.3</p><p>print(type(a)) #查看变量a是什么数据类型</p><p>print(type(30)) #查看数字30是什么数据类型</p><p><br/></p><p>b = 10</p><p>print(&quot;a+b的结果是：&quot;,a+b)</p><p>print(&quot;a-b的结果是：&quot;,a-b)</p><p>print(&quot;a/b的结果是：&quot;,a/b)</p><p><br/></p><p>print(&quot;a整除b的商是：&quot;,a//b)</p><p>print(&quot;a整除b的余数是：&quot;,a%b)</p><p><br/></p><p>x = 10</p><p>y = 0</p><p>print(x/y) #被除数为0，报错</p><p>-------------------------------------</p><p>06_string.py</p><p>-------------------------------------</p><p>number_a = input(&quot;请输入一个数字：&quot;)</p><p>print(type(number_a))</p><p>number_a = int(number_a) #把字符串强制转化为一个数字类型</p><p>print(type(number_a))</p><p><br/></p><p>number_b = input(&quot;请输入另一个数字：&quot;)</p><p>print(type(number_b))</p><p>number_b = int(number_b) #把字符串强制转化为一个数字类型</p><p>print(type(number_b))</p><p><br/></p><p>sum = number_a + number_b</p><p>print(number_a,&quot;+&quot;,number_b,&quot;的值是：&quot;,sum)</p><p><br/></p><p>#思考问题</p><p>#是不是所有的str类型都可以转化成int类型？</p><p>#int类型能够转化成str类型吗</p><p>#两个str类型相加得到什么样的结果？</p><p>#str还有其他操作吗？</p><p><br/></p><p><br/></p><p>#字符串的格式化</p><p>c = &quot;{}hello world{}&quot;</p><p>c.format(100,&quot;，你好！&quot;)</p><p>print(c)</p><p><br/></p><p><br/></p><p>#字符串的替换</p><p>print(&quot;chuanzhi_boke&quot;.replace(&quot;_&quot;,&quot;&quot;))</p><p>#print(&quot;chuanzhi_boke&quot;.replace(&quot;_&quot;,1000))#出错，数据类型不匹配</p><p><br/></p><p>#字符串的长度</p><p>d = &quot;chuanzhi&quot;</p><p>print(len(d))</p><p>print(d[0])</p><p>print(d[1])</p><p>print(d[2])</p><p>print(d[len(d)-1])</p><p>print(d[-1])</p><p>print(d[-2])</p><p>print(d[0]+d[1]+d[3])</p><p>print(d[0:5])#从0开始到第5个之前，称为切片操作</p><p>print(d[0:8])#整个字符串</p><p>print(&quot;&nbsp; chuanzhi&nbsp; &nbsp;&quot;.strip())#去除字符串前后的空格</p><p>-----------------------------------------------------------</p><p>07_bool.py</p><p>---------------------------------------------</p><p>f = &quot;chuanzhi&quot;</p><p>print(type(&quot;c&quot; in f))#bool类型</p><p>f = 1 #给f赋值为1</p><p>print(f == 1)#判断f和1是否相等，返回值为TRUE</p><p>print(0&lt;f&lt;3) #TRUE</p><p>print(2&lt;f&lt;3) #False</p><p>-------------------------------------------------</p><p>08_list.py</p><p>--------------------------------------------<br/></p><p>print(&quot;chuan_zhi&quot;.split(&quot;_&quot;)) #切割字符串，split方法</p><p>print(type(&quot;chuan_zhi&quot;.split(&quot;_&quot;))) #list类型</p><p>c = []</p><p>print(type(c))#c的数据类型</p><p>d = [&quot;1&quot;,2,3.14,&quot;人生苦短，我用python&quot;,[1,2,3]]#列表中可以放任意数据类型的数据</p><p>print(type(d))#d的数据类型</p><p>print(len(d))#求列表长度</p><p><br/></p><p>a = [1,2]</p><p>a.append(3)</p><p>a.append(True)</p><p>print(a)</p><p><br/></p><p>b = [1,2,3,4,5,6,7,8,9]</p><p>print(b[2:5])#从下标2到下标5个之前。结果为[3,4,5]</p><p>print(b[2:5:2])#步长为2，结果[3,5]</p><p>print(b[9:0:-3])#步长为-3，结果[9,6,3]</p><p>print(b[::-1])#整个列表，步长为-1，反向取值，结果为[9,8,7,6,5,4,3,2,1]</p><p><br/></p><p>a = [1,2]</p><p>b = [3,4]</p><p>c = [5,6]</p><p>a.extend(b)#两个列表合并</p><p>print(a)</p><p>print(a+c)</p><p><br/></p><p>d = a + b</p><p>print(d.index(3))#获取列表的中某元素第一次出现的下标</p><p><br/></p><p>f = [1,2,3]</p><p>f.insert(0,&quot;a&quot;)#此运算的结果并不是一个列表，,这里结果为none，和append\extend一样</p><p>print(f)#在列表中某下标的位置，插入一个值</p><p><br/></p><p><br/></p><p>g = [1,2,3,2,3,2,5]</p><p>g.remove(2)#移除列表中第一个出现的某元素</p><p>print(g)</p><p><br/></p><p>#pip install ipython</p><p>#pip --vision</p><p>#help(a.insert)</p><p>#tab自动补全，点的后面用tab，提示可用的方法</p><p>-------------------------------------------------</p><p>09_dict.py</p><p>-----------------------------------------------</p><p>c = {}</p><p>c[&quot;xiaoming&quot;] = 20#小明赋值</p><p>print(c)</p><p><br/></p><p>c[&quot;xiaohong&quot;] = 30#小红赋值</p><p>print(c)</p><p><br/></p><p>print(c[&quot;xiaohong&quot;])#取出小红的值</p><p><br/></p><p>c[&quot;xiaohong&quot;] = 100#更新小红的值</p><p>print(c)</p><p><br/></p><p>d = c.pop(&quot;xiaohong&quot;)#从c中取出小红的值，同时在c中删除小红</p><p>print(d)</p><p>print(c)</p><p><br/></p><p><br/></p><p>#两个字典的合并</p><p>d = {&quot;xiaoming&quot;:200}</p><p>c.update(d)#c更新了小明的值为200</p><p>print(c)</p><p><br/></p><p>e = {&quot;xiaogang&quot;:300}</p><p>c.update(e)#合并两个字典，结果顺序不重要,字典是没有顺序的。</p><p>print(c)</p><p><br/></p><p><br/></p><p>c[&quot;e&quot;] = e</p><p>print(c)</p><p><br/></p><p>c[&quot;f&quot;]=&quot;chuangzhi&quot;</p><p>print(c)</p><p><br/></p><p>print(c[&quot;e&quot;][&quot;xiaogang&quot;])#嵌套的字典键值输出</p><p>----------------------------------------------------------------------</p><p>请同学们参考练习，亲手敲代码，脚踏实地的编程！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/42.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=42</wfw:commentRss></item><item><title>python虚拟环境安装和配置</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/python虚拟环境.html</link><pubDate>Mon, 20 Aug 2018 22:34:22 +0800</pubDate><guid>http://gaohualing.cn/post/python虚拟环境.html</guid><description><![CDATA[<p>转载。原文：<a href="https://www.sohu.com/a/225685309_491081" _src="https://www.sohu.com/a/225685309_491081">https://www.sohu.com/a/225685309_491081</a></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">最近家里电脑重装了系统，所以又重新安装了python和pycharm编辑器，但是在这次安装过程中，遇到了一个前所未见的问题，在cmd命令中直接用pip install selenium，导入安装了selenium模块，但是在pycharm中运行代码报错，Chromedriver和谷歌浏览器也是一一对应的，但是打不开谷歌浏览器，如图</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/89debc88ff1b41ed8ebdcf587ef0a764.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">发现报错信息是找不到名字为Chrome的对象，一开始以为是谷歌驱动的问题，反复检查无误后。想到应该是selenium模块的问题，但是在Python自带的IDE中import selenium 发现能正常运行。这就比较尴尬了，这个问题困扰了我好几天。以前也用了那么久的selenium，没出现这个问题，也没在意，现在发现了问题以后，网上能百度的全都百度了，所有方法都试了，没有解决问题，后来看到了Python3的项目下自带了一个venv这个，百度了一下，原来是这个venv搞的鬼。以下是我百度在CSDN某个大牛下找到的参考资料：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">原文如下</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">python虚拟环境virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">VirtualEnv用于在一台机器上创建多个独立的python运行环境，VirtualEnvWrapper为前者提供了一些便利的命令行上的封装。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Virtualenv是一个非常好的virtual python environment builder，他最大的好处是，可以让每一个python项目单独使用一个环境，而不会影响python系统环境，也不会影响其他项目的环境。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Virtualenv可用于创建独立的Python环境，在这些环境里面可以选择不同的Python版本或者不同的Packages，并且可以在没有root权限的情况下在环境里安装新套件，互相不会产生任何的影响。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/35fbca736f2445859995bad0ad4f6ef6.png" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">为什么要用virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">- 隔离项目之间的第三方包依赖，如A项目依赖django1.2.5，B项目依赖django1.3。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">- 为部署应用提供方便，把开发环境的虚拟环境打包到生产环境即可,不需要在服务器上再折腾一翻。在服务器上都不用安装virtualenv，直接将virtualenv创建的目录拷贝到服务器，修改路径，进行虚拟环境迁移就可以用了。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">- 还可以用在没有root权限的python环境配置上，如果没有root权限，可以先自己搞一个virtualenv，再在virtualenv中使用pip安装。（系统中没有pip，并且也没有root权限使用sudo apt-get安装）</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装的库的位置</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">env/Lib/site-packages/目录里，而不是在系统的python的Lib/site-packages目录里，这样你就知道为什么虚拟环境是分开的了吧。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note:virtualenv 创建的虚拟环境与主机的 Python 环境完全无关，你主机配置的库不能在 virtualenv 中直接使用。你需要在虚拟环境中利用 pip install 再次安装配置后才能使用。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Virtualenv的安装</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pip安装virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pip install virtualenv #py2安装</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pip3 install virtualenv #py3安装，这样用virtualenv创建的virtualenv默认python版本是py3</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">这时python3.4.2\Lib\site-packages目录下会出现两个新子目录virtualenv_support、virtualenv-13.1.0.dist-info</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[pip]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装Virtualenvwrapper</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[可能需要掌握一些常见的virtualenvwrapper的命令，方便管理Python的版本，链接在：http://www.doughellmann.com/docs/virtualenvwrapper/command_ref.html]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装完以后，创建一个虚拟环境，然后在安装virtualenvwrappervirtualenv ENV #ENV 为环境的名字，可以任意设置，其实就是一个文件夹，在home下的用户名文件夹下可以找到。source ENV/bin/activate #这样进进入了virtualenv的虚拟开发环境。进入虚拟环境以后命令行最开始的地方会显示（ENV），代表已经进入了这个环境，然后就可以安装virtualenvwrapper和Django了</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">输入命令行pip install virtualenvwrapper这里可以不用sudo，因为在virtualenv里，不用管理权限也算是很方便的设计之一。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenvwrapper安装后，它会把virtualenv列为依赖包，所以会自动安装。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">打开一个新的shell，输入mkvirtualenv test 。如果你打开另外一个shell，则你就不在这个virtualenv中了，你可以通过workon test 来启动。如果你的工作完成了，可以使用deactivate 来停用</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/e3cfabac809e4260a1ec37dd7f486528.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">创建虚拟环境并进入使用</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">使用virtualenv默认python版本创建虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv --no-site-packages ubuntu_env</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">就可以在当前目录创建一个env目录(虚拟环境名称，这个文件夹就是保存 Python 虚拟环境)，你会注意到，virtualenv会把python，setuptools和pip给你安装上。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">自定义python版本创建虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">1. 安装需要版本的python2. 指定virtualenv中的python版本virtualenv --no-site-packages --python=2.7 env</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note:</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">1. 创建virtualenv虚拟环境之前，系统中必须要安装有对应版本的python，并且卸载之后当前虚拟环境就无效了。系统中可以同时存在python2和python3，通过环境变量中的系统变量path（不是用户变量）控制cmd或者系统中使用哪个版本的python，哪个版本的路径在前面就优先使用哪个版本。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">2. –no-site-packages表示不包括系统全局的Python安装包，这样会更令环境更干净</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">2. –python=python2.7指定Python的版本未系统已经安装了的Python2.7</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">3. env是建立的虚拟环境名称</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">4 .没有安装python2.7或者使用命令virtualenv --no-site-packages --python=python2.7 env会出现The executable python does notexist 错误</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">进入虚拟环境并激活</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Linux(mac os):</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">. ubuntu_env/bin/activate</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pika:/media/pika/files/mine/python_workspace/NLP$d envGoing to /media/pika/files/mine/ENVpika:/media/pika/files/mine/ENV$. ubuntu_env/bin/activate(ubuntu_env) pika:/media/pika/files/mine/ENV$d nlpGoing to /media/pika/files/mine/python_workspace/NLP(ubuntu_env) pika:/media/pika/files/mine/python_workspace/NLP$pythonPython 3.4.3 (default, Oct 14 2015, 20:28:29)</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">windows:</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">env &gt; \activate (or \activate.bat)</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/9eee302de6674de59863ca080476c2d2.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">mingw(git):</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">venv &gt;source s/activate</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/3e99541af6f940bcad0d20d0512ffc06.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">这时会发现，在命令行前面，会多出(env)出来，表示你已经进入了虚拟机了。现在你可以使用pip install xxx来安装你想要的库了。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: activate.bat脚本会设置控制台环境变量，使得该控制台以后调用的python命令会执行虚拟环境中的python。virtual env激活后，在任意目录输入python, ipython(如果安装了)都会调用virtual env中的命令。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">退出虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">(ubuntu_env) pika:/media/pika/files/mine/ENV/ubuntu_env$deactivatepika:/media/pika/files/mine/ENV/ubuntu_env$</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: deactivate命令可能在virtualenv安装目录下。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">直接在该环境中使用deactivate命令即可退出</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/9f195dd1be4447978e17ccb98f598fd9.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: deactivate.bat是还原控制台环境变量设置</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">删除虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">rm -r venv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">直接删除虚拟环境所在的文件夹venv就删除了我们创建的venv虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">linux下virtualenv其它命令</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">列出虚拟环境列表</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">workon</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">也可以使用lsvirtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">新建虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">mkvirtualenv [虚拟环境名称]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">启动/切换虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">workon [虚拟环境名称]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">删除虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">rmvirtualenv [虚拟环境名称]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">虚拟环境迁移</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">当需要将虚拟环境env转移到同一台电脑的另一个目录下时</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">或者当需要将虚拟环境env1迁移或复制到另一个虚拟环境（可能不在同一台机器上）env2时，首先仍然需要在目的机器上安装pip和virtualenv，然后采用以下方法之一安装其他的package：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">1.直接将env1里的文件全部复制到env2里，然后修改涉及路径的文件。此种方法可能正常使用，但显然不是好办法(不过网络不好的时候lz就是用的这个)。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">修改的路径主要是虚拟环境ubuntu_env/bin目录下的文件执行程序的路径：如active, pip, ipython等等（几乎所有文件的路径，不过有的命令你不用的可以不改）。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如将虚拟环境ubuntu_env/bin/active中的路径修改一下：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">其中的VIRTUAL_ENV路径其实最好修改成现在的绝对路径VIRTUAL_ENV=&quot;/media/pika/files/mine/ENV/ubuntu_env&quot;；</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">将虚拟环境ubuntu_env/bin/pip和pip3和pip3.4中的路径修改成绝对路径：#!/home/pipi/ENV/ubuntu_env/bin/python3</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">注意最好不要将路径修改成相对路径。如果修改的ipython执行路径为相对路径#!./bin/python3，是相对这个ipython.py执行的路径，激活virtual env后如果在另一个目录下输入python就会出错找不到或者直接调用系统中的python了，而不是virtual env中的python，而原始的默认路径使用绝对路径就可以在virtual env激活后在任意目录都可以执行ipython而不出错！</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">2. 使用requirements.txt</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">进入原虚拟环境env1，然后执行pip freeze &gt; requirements.txt将包依赖信息保存在requirements.txt文件中。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">最好手动调整一下顺序，比如numpy和scipy要在matplotlib前面安装；另外如果想安装最新版本的，再将后面的版本号==1.9.1什么的删除。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">然后进入目的虚拟环境env2，执行pip install -r requirements.txt，pip就会自动从网上下载并安装所有包。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">虚拟环境env2如果是env1的拷贝，最好先pip uninstall -ry requirements.txt，再pip install -r requirements.txt</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">3.pip默认会从pypi服务器（http://pypi.python.org/simple）下载包的安装文件，如果目的机器无法连外网，则可以采用以下办法：3.1搭建自己的pypi服务器。专业的，可以使用第三方的软件包来搭建一个完整的pypi镜像服务器，参考http://www.worldhello.net/2011/03/14/2357.html。更快速的方法只需要一条命令python -m SimpleHTTPServer即可完成搭建服务器，具体的目录结构可参考原pypi服务器，简而言之，就是把安装文件打包放入目录即可。搭建好服务器之后，在目的虚拟环境中，就可以使用pip来安装了，命令如：pip install -i http://127.0.0.1:8000/ -r requirements.txt3.2如果你实在不想搭建pypi服务器，也有办法。首先将所有包的安装文件下载下来，可以手动下载，也可以使用pip，如pip install -d /path/to/save/ -r requirements.txt，然后自己修改requirements.txt文件，将每一行改成对应的包的安装文件的路径。最后在目的虚拟环境中使用pip安装，如pip install -r requirements.txt即可。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">3.3还有一种途径，就是pip提供的bundle选项。首先执行pip bundle MyEnv.pybundle -r requirements.txt，将生成一个MyEnv.pybundle文件，该文件夹包含所有包的安装文件（注意必须后缀名必须是.pybundle），默认是重新从pypi服务器下载安装文件的，如果愿意，也可以利用3.1中的方法，指定本地的pypi服务器。然后在目的虚拟环境中执行pip install MyEnv.pybundle即可</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">所以说，lz还是更喜欢docker中配置的python开发环境。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">虚拟环境迁移出错</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">方法1虚拟环境迁移后包引入出错</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">from scipy import stats</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">ImportError: liblapack.so.3: cannot open shared object</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">这时只需要pip install scipy重新安装一下就ok了。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">ImportError: libBLT.2.4.so.8.6: cannot open shared object file: No such file or directory, please install the python3-tk package</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">也要重新安装matplotlib</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">所以最好使用方法2迁移。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Virtualenv中安装python拓展包</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pip安装时，使用命令pip, pip3, pip3.4都可以，因为virtualenv中安装的如果是py3则pip对应的就是pip3。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">注意，虚拟环境中安装python拓展包需要先如上进入虚拟环境，不然就安装在系统的python路径下了。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv从requirements.txt中安装python库</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">进入原虚拟环境env1，然后执行pip freeze &gt; requirements.txt将包依赖信息保存在requirements.txt文件中。然后进入目的虚拟环境env2，执行pip install -r requirements.txt，pip就会自动从网上下载并安装所有包。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">requirements.txt:</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">numpy</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pandas</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv中安装numpy</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">通过pip install numpy直接安装numpy！</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv中安装scipy和matplotlib</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">You may have to install some extra non-Python dependencies using apt-get.在安装scipy前，要先在系统中安装scipy的非python依赖，好像是fortran的。ubuntu16.04出来时已经不用了？</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Building Matplotlib requires libpng (and freetype, as well) which isn&#39;t a python library, so pipdoesn&#39;t handle installing it (or freetype).</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">sudo apt-get build-dep python-scipy</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">sudo apt-get -y build-dep matplotlib</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">(virtualenv) pip install scipy(virtualenv) pip install matplotlib</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[Install python-scipy in a virtualenv]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[How to install matplotlib using virtualenv on Ubuntu]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[Installing]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">windows下virtualenv中安装pywin32</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv中不能直接用pip install pywin32，否则会出错：Couldnot find any downloads that satisfy the requirement. pywin32 No distributions at all foundfor pywin32.</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Solution1</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">在http://sourceforge.net/projects/pywin32/files/ 找到你要的exe文件下载地址</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">激活virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">运行easy_install http://PATH.TO/EXE/DOWNLOAD</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: easy_install 太老的话可能出错：error: c:\users\blah\appdata\local\temp\easy_install-ibkzv7\pywin32-214.win32-py2.6.exe is not a valid distutils Windows .exe</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Solution2</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如果下载不下来也可以这样</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">http://sourceforge.net/projects/pywin32/files/ 中下载exe文件到本地</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">激活virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">运行easy_install DOWNLOADED_FILE.exe e.g. easy_install D:\Downloads\Programming\Python\python3\pywin32-219.win-amd64-py3.4.exe</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Solution3（亲测有效）</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">系统中安装pywin32后，将pywin32.pth复制到virtualenv site-packages并编辑文件指定相关路径。[PyWin32 and virtualenv]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">&gt; copy D:\python3.4.2\Lib\site-packages\pywin32.pth E:\mine\python_workspace\CrawlerEnv\Lib\site-packages\pywin32.pth</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">查处文件内容more E:\mine\python_workspace\CrawlerEnv\Lib\site-packages\pywin32.pth&#39;</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"># .pth file for the PyWin32 extensionswin32win32\libPythonwin</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">将其自改为：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">D:\python3.4.2\Lib\site-packages\win32D:\python3.4.2\Lib\site-packages\win32\libD:\python3.4.2\Lib\site-packages\Pythonwin</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">这样就可以成功引入，并且可以在pycharm中使用：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/e107f8cfa3174457a79f52ff889bda60.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[How to install win32com module in a virtualenv?]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[How can I use pywin32 with a virtualenv without having to include the host environment&#39;s site-packages folder?]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[How to install pywin32 in virtualenv with python 2.7 64 bit?]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">virtualenv中安装rsae</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">python版本是python3</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/ccf2a575a3bf47c9996098baaa2e6faa.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: lz不知道为嘛要先重启电脑才能安装成功，否则报错could not find the version that satisfies the requirement rsa</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">查看virtualenv中已经安装的python包列表</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">(ubuntu_env) pika:/media/pika/files/mine/python_workspace/ubuntu_env$pip listnumpy (1.10.4)pip (8.1.1)py4j (0.9.2)setuptools (20.3.1)sh (1.11)wheel (0.29.0)(ubuntu_env) pika:/media/pika/files/mine/python_workspace/ubuntu_env$pip freezenumpy==1.10.4py4j==0.9.2scipy==0.17.0sh==1.11</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Note: virtualenv中的pip应该就是pip3默认的。两种方式还是有一丁丁不同的。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pycharm项目配置虚拟环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">在pycharm中设置项目在virtualenv中运行</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">首先virtualenv venv创建一个虚拟环境并安装好相关运行环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">打开pycharm</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/40bfe8acec9e43109e11d0d48cdc3055.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">下拉框中可以选择需要的运行环境</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如果找不到创建的虚拟环境，可以在右边设置按钮中添加一个新的python interpreter， add local选择创建的虚拟环境venv中的python解释器（如D:\venv\s\python.exe）就可以了</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">多个不同python版本共存</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">我们可以用许多方法让不同的 Python 版本在系统上共存，例如在 OS X 上，如果使用官方提供的 DMG 版本安装，那么自带的 python2 和新安装的 python3 是可以共存的。python3 可以使用 python3 来调用，甚至 pip 都可以使用 pip3 来调用。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">1. 自己配置</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">同时安装python2和python3，然后在系统变量中修改两个的顺序就可以设置系统中优先使用哪个版本的python</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如果是用anaconda安装的python2，再安装python3就必须在python3安装程序中设置不安装pip，否则安装程序会出错，无法安装成功（所以小编从来都是需要什么拓展包才安装，从不用anaconda一次安装那么多没用的东西）。安装python3成功后，再下载运行get-pip.py文件安装pip就ok了</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">2. pyenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如果有很多小版本需要共存，pyenv 用来解决这类问题。它可以安装、卸载、编译、管理多个 python 版本，并随时将其中一个设置为工作环境。But pyenv 不支持 Windows 系统。[Python多版本共存之pyenv]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">3. pywin</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Windows 上有一个 pyenv 的替代品，是 pywin 。它用来在多个安装的 Python 版本之间进行切换（就是在windowns中已经安装了多个版本的python），也支持 MSYS/MINGW32 。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装和使用：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pip install pywin</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">C:\&gt;pywin genlaunchersSearch for python installations and create batch files in the same directory where pywin is installed.</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">C:\&gt;pywin # launch first python found in PATHC:\&gt;pywin -2.7 # launch python 2.7C:\&gt;pywin setdefault 3.4Setting default python for active session to: 3.4C:\Python34;C:\Python34\s -- now at front of PATH #相当于1中的自己配置</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">C:\&gt;pywin -3.2 test.py # launch test.py with python 3.2C:\Python32</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/6785bf5e5ddb491b998fb88e4e2e0ba7.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pywin启动python版本的顺序：Any version specified after a #! in the first 2 lines of the source. The interpreter will be invoked with any additional parameters.examples:#! python3.3#! /usr/bin/python2.7 -vIf the environment variable VIRTUAL_ENV is set, use that virtualenv&#39;s python.exe.If the environment variable PYTHONHOME is set, use its python.exe.If none of the above, fall back to the first python.exe found on the path.4. Python Launcher for Windows</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Python 从3.3版本开始（又是3.3？），在 Windows 系统中自带了一个 py.exe 启动工具。如果你是使用 Python.org 官网下载的安装包安装的 Python 3.3（或更新版本）环境，那么可以直接在命令提示符中使用这个工具。py 可以打开默认的 python 提示符； py -2.7 和 py -3 打开对应的 Python 版本。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">另两种解决方案</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Anaconda</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Conda 是 Continuum 公司发布的 Anaconda 里边配备的一个包管理器。Conda 让你更加方便地安装和管理各种扩展包和运行环境，同时支持 Windows，Mac OS X 以及 Linux。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">下载anacondaPython 3版本</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">~/ENV$ wget http://repo.continuum.io/archive/Anaconda3-4.1.1-Linux-x86_64.sh</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">bash Anaconda3-4.1.1-Linux-x86_64.sh</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">运行安装时注意不要一直enter，要设置一下anaconda安装目录及是否加入用户默认.bashrc中。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">#PREFIX=~/opt/anaconda3</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/pipi/.bashrc ? [yes|no][no] &gt;&gt;&gt; yes</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">重启terminal就可以使用conda安装了</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">这样安装的python就是用户独立的！linux下不同用户输入python都是对应自己安装的anaconda，pip也是。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">使用</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">使用conda安装python拓展包</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Conda支持多种配置选项。修改这些选项最简单的方法就是使用conda config命令。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Conda 通过使用 SAT 求解器加上一个伪布尔约束，来解决包之间的依赖关系。当 Conda 安装扩展包时，它会尝试查找和这个包结合在一起能够使用的那些包的最新版本。更新全部包，就是尝试安装每个包，让 SAT 求解器找到最新可用的版本。conda update –all 可以很容易的实现这一功能。例如，如果你现在安装了 Python 2.7.4, Nunpy 1.8.0, 和 SciPy 0.14.0, conda update –all 就和 conda install “python&gt;=2.7.4, &lt;3” “numpy&gt;=1.8.0” “scipy&gt;=0.14.0” 的功能一样（除此之外还包括一些Python的依赖关系，比如 readline 和 OpenSSL）。值得注意的是 conda update –all 不会把 Python 2 升级到 Python 3 。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">如果你想把某一个包升级到比 anaconda 元包指定的版本，你可以通过 conda remove anaconda 来移除它。（这会移除元包，里面不包含任何代码。）</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">conda list –export 和 conda create –file</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">使用 Conda 可以很简单地复制环境。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">conda list --export conda_list.txt 可以导出所有你已经安装好的包，包括版本和编译字符。你可以把这些保存在文件里。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">同时使用 conda install --file conda_list.txt 或者 conda create --file 来安装同样的包。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">conda clean</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">使用一段时间之后， Conda 会占用很多硬盘空间，这是因为它不会自动删除一些没用的包。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">你可以通过 conda clean -p 来删除这些没用的包。这个命令会检查哪些包没有在包缓存中被硬链接到其他任何地方，并删除它们。注意，如果你是通过 symlink 等方式或通过一个单独的文件系统安装的包，你就没有办法使用这个命令删除它们，因为它检测不到它们的存在。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">Conda 也会保存所有下载下来的 tar 包。它们只是为了缓存才保存下来的，是可以被删除的。你可以通过 conda clean -t删除它们。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">钉包（Pinning Packages）</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">默认情况下，Conda 会在环境中安装一个包的最新版本。但是，有时候你可能会想保留某一个旧版本的包，哪怕你之后安装的包要依赖这个包的新版本（Conda 默认会升级你已经安装的包的依赖包）。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">例如，假设你在你的环境里已经安装了 SciPy 0.13.3， 但是你现在还不想升级到 0.14.0（文章发表时的最新版本），虽然你安装了其他依赖于 SciPy 的包，比如 Pandas。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">为了达到目的，可以在你的环境中的 conda-meta 目录下创建一个叫 pinned 的文件。例如，如果你有一个叫做 scipy-0.13 的环境，你可以这么写：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">$ echo &quot;scipy 0.13.3&quot; &gt; ~/anaconda/envs/scipy-0.13/conda-meta/pinned</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pinned 文件中的每一行都应符合 conda 匹配规则。这就允许一些通用的事情，比如说指定 scipy&lt;0.14。其中以‘#’号开头的行会被忽略。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">它的工作原理是，每次 conda 在你的环境里安装扩展包时，conda 会把 pinned 文件里的每一行内容都附带发送给 SAT 求解器，这样就阻止了那些你不想要的升级。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">忽视 pinned 文件，可以使用conda install --no-pin 。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">[学习 Conda 的高级特性（上）]</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">pyenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">python3自带了pyvenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">from:http://blog.csdn.net/pipisorry/article/details/47008981</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">ref:使用VitrualEnvWrapper隔离python项目的库依赖</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">一种部署 Python 代码的新方法dh-virtualenv</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">相信看了以上大牛的文档，应该大致知道自己哪个地方有问题了，我之前用过的python版本没有自带虚拟环境，通过pip安装的模块，每个项目都能直接调用。而这个python版本自带虚拟环境，每个项目下面又要重新安装模块，这个项目才能调用。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">解决办法：1.进入自己创建项目的venv文件夹，启动activate.bat文件，在cmd中运行这个文件，相当于启动虚拟机。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">2.运行启动虚拟机后，进入你项目的文件夹下面的s目录下，pip install selenium。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装如图：</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/7604642924364656841517252e29e7da.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">安装完成后，重新运行代码，发现再也没有报错了，浏览器也能自动打开了。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/c7c0d73a976143a49f871bff66b489b1.jpeg" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><img src="https://5b0988e595225.cdn.sohucs.com/images/20180316/40ce8925252f416cbe3e0b20ab43a192.png" max-width="600" style="border: 0px; margin: 10px auto 0px; padding: 0px; display: block; max-width: 100%; height: auto;"/></p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">http://www.aibbt.com/a/22238.html</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">总结：python3.3以后版本自带虚拟环境，每个项目下面又要重新安装模块，这个项目才能调用。 Venv这个自带的虚拟环境用处就是为了防止不同的项目环境污染，单独的项目只能调用这个项目下导入的模块 。</p><p style="border: 0px; margin-top: 0.63em; margin-bottom: 1.8em; padding: 0px; font-size: 16px; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(25, 25, 25); font-family: &quot;PingFang SC&quot;, Arial, 微软雅黑, 宋体, simsun, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">用了那么久的selenium还不知道这个，真是惭愧至极，还是得努力学习啊，路漫漫其修远兮，吾将上下而求索！</p><p><br/></p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/python虚拟环境.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=41</wfw:commentRss></item><item><title>mysql安装完成后，如何添加root用户的密码</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/mysql修改root用户密码.html</link><pubDate>Sat, 18 Aug 2018 22:26:37 +0800</pubDate><guid>http://gaohualing.cn/post/mysql修改root用户密码.html</guid><description><![CDATA[<p style="margin: 15px auto 10px; padding: 0px;">在修改mysql的密码时，如下图所示。</p><p style="margin: 15px auto 10px; padding: 0px;">直接进入mysql数据库：mysql -u root -p回车，这时密码为空，直接回车。</p><p>进入mysql后，设置密码：set password=password(&#39;123456&#39;);</p><p>然后退出mysql：exit;</p><p>再次用密码进入，进行测试：mysql -u root -p回车，密码输入：123456回车，顺利进入mysql数据库</p><p>显示所有的数据库：show databases;<br/></p><p><img src="http://gaohualing.cn/zb_users/upload/2018/8/2018081881352145.png" style="width: 586px; height: 517px;"/></p><p>成功！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/mysql修改root用户密码.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=40</wfw:commentRss></item><item><title>有mysql安装文件夹备份的如何快速重装</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/mysql快速重装.html</link><pubDate>Sat, 18 Aug 2018 21:54:16 +0800</pubDate><guid>http://gaohualing.cn/post/mysql快速重装.html</guid><description><![CDATA[<p>我是因为重装系统，需要重新安装mysql。</p><p>于是乎直接拷贝文件夹mysql5.7目录放在D盘根目录。</p><p>修改bin目录下的my.ini文件中的两个目录。</p><p>basedir=&quot;D:\\mysql5.7&quot;&nbsp;&nbsp;</p><p>datadir=&quot;D:\\mysql5.7\\Data&quot;&nbsp;&nbsp;<br/></p><p>然后运行cmd，切换到了D:/mysql5.7/bin目录<br/></p><p>执行：mysqld install回车</p><p>提示服务安装成功</p><p>先一步需要初始化数据库，但是data目录已经存在会提示错误。</p><p>初始化为空密码的数据库：mysqld --initialize-insecure --user=root</p><p>如果这时直接启动mysql服务是无法启动的。</p><p>原因很简单，data目录是已经存在的，无法完成上面的初始化操作。</p><p>启动服务：net start mysql</p><p>这时将会出现无法启动的提示。</p><p>或者直接到控制面板中的服务里查看，mysql服务已经存在。</p><p>手动启动，将会出现提示：</p><p>“本地计算机上的mysql服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”</p><p>解决方案：很简单，将data目录删除或者移动到其他目录。</p><p>重新运行上面的初始化数据库的操作，然后启动服务就可以成功了。</p><p>于是，迫不及待的赶紧测试一下数据库：输入：mysql -u root -p回车，密码不输入，直接回车即可。</p><p><img src="http://gaohualing.cn/zb_users/upload/2018/8/2018081880352737.png"/></p><p>之后需要停止服务，复制data文件夹中以前的数据库进来。再次启动服务就可以使用旧的mysql数据库了。</p><p><img src="http://gaohualing.cn/zb_users/upload/2018/8/2018081882200017.png"/></p><p>停止服务：net stop mysql</p><p>停止服务之后，拷贝您的数据库文件夹到现在的data目录中，如图所示：</p><p><img src="http://gaohualing.cn/zb_users/upload/2018/8/2018081882448457.png" style="width: 607px; height: 345px;"/></p><p>再次启动服务：net start mysql</p><p>查看mysql数据库，如图显示，已经添加成功。</p><p><img src="http://gaohualing.cn/zb_users/upload/2018/8/2018081882580185.png"/></p><p>下面的问题是修改mysql密码：请看下一篇文章：mysql安装完成后，如何添加root用户的密码。</p><p>有问题请各路神仙留言，共同讨论！共同进步！</p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/mysql快速重装.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=39</wfw:commentRss></item><item><title>重新安装mysql数据库</title><author>null@null.com (shuibing)</author><link>http://gaohualing.cn/post/重装mysql.html</link><pubDate>Sat, 18 Aug 2018 08:53:15 +0800</pubDate><guid>http://gaohualing.cn/post/重装mysql.html</guid><description><![CDATA[<p>本文转载于：<a href="https://blog.csdn.net/qq_38793958/article/details/81028398" _src="https://blog.csdn.net/qq_38793958/article/details/81028398">https://blog.csdn.net/qq_38793958/article/details/81028398</a> </p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 16px;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all;">前言</span></span></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">由于安装某个项目的执行文件，提示要卸载MySQL以便它自身MySQL安装，然后我禁用了MYSQL服务，再把这个文件夹删除后，发现还是提示请卸载MYSQL服务。</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">--------------------------------------------------------------------</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">禁用服务方式如下：</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><img src="https://images2015.cnblogs.com/blog/688865/201702/688865-20170223115226945-1743514558.png" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; border: 0px;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">或者 我的电脑右键-&gt;管理-&gt;服务，进入后手动禁用。</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">&nbsp;--------------------------------------------------------------------</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 16px;">通过网上查询后总结如下：</span></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 14px;">1.在cmd中，输入sc delete mysql，删除服务。</span></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><img src="https://images2015.cnblogs.com/blog/688865/201702/688865-20170223113250788-696907344.jpg" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; border: 0px;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">2.但是MYSQL服务只是显示禁用状态，并没有真正清理干净。</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><img src="https://images2015.cnblogs.com/blog/688865/201702/688865-20170223113715070-2120494646.png" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; border: 0px;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">3.删除相关注册表信息</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">在Win7开始菜单栏搜索 regedit 进入注册表编辑器（在cmd下输入此命令也是可以打开的）</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">路径1：\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\eventlog\Application\MySQL</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">路径1：\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\services\eventlog\Application\MySQL</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">删除整个MySQL文件夹即可</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><img src="https://images2015.cnblogs.com/blog/688865/201702/688865-20170223113853648-1495118828.jpg" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; border: 0px;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><img src="https://images2015.cnblogs.com/blog/688865/201702/688865-20170223113859210-1072134725.jpg" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; border: 0px;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">4.MySQL服务彻底清除干净了，可以安装那个执行文件了。</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);">二，安装</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 13px; line-height: 26px; word-break: break-all; white-space: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; background-color: rgb(245, 245, 245);"><br/></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">1</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、将下载好的</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">压缩包解压到安装目录下</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);"><img src="https://img-blog.csdn.net/20180713112106556?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">2</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、新建文件</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">my.ini</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">，放置到</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">安装目录下，内容如下：</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(248, 248, 248);"><a href="http://www.jb51.net/article/134181.htm" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; color: rgb(103, 149, 181); text-decoration-line: none; cursor: pointer; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(0, 102, 153);">?</span></a></p><table cellspacing="0" cellpadding="0" width="852"><tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;"><tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;" class="firstRow"><td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; color: rgb(79, 79, 79); line-height: 22px;"><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">1</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">2</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">3</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">4</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">5</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">6</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">7</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">8</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">9</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">10</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">11</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">12</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">13</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">14</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">15</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">16</span></p></td><td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; color: rgb(79, 79, 79); line-height: 22px;"><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">[mysql]</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">设置mysql</span>客户端默认字符集</p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">default-character-set=utf8</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">[mysqld]</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">设置3306</span>端口</p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">port = 3306</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">设置mysql</span>的安装目录</p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">basedir=F:\work office\mysql-5.7.21\mysql-5.7.21-winx64</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">设置mysql</span>数据库的数据的存放目录</p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">datadir=F:\work office\mysql-5.7.21\mysql-5.7.21-winx64\data</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">允许最大连接数</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">max_connections=200</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">服务端使用的字符集默认为8</span>比特编码的latin1字符集</p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">character-set-server=utf8</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">#&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">创建新表时将使用的默认存储引擎</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34); background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">default-storage-engine=INNODB</span></p></td></tr></tbody></table><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);"><img src="https://img-blog.csdn.net/20180713112126464?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">3</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、安装</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">服务</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">已管理员身份打开</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">cmd</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">窗口，将目录切换到</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">安装文件夹下的</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">bin</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">目录下</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);"><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></span></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">执行</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysqld install</span></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);"><img src="https://img-blog.csdn.net/20180713112145874?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">4</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、初始化</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">数据库，输入</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">“mysqld --initialize --user=root --console”</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">。下面红色文字为初始化后的</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">root&nbsp;</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">密码</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><img src="https://img-blog.csdn.net/20180713112154321?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><a href="http://files.jb51.net/file_images/article/201802/201821111923233.jpg?201811111930" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; color: rgb(103, 149, 181); text-decoration-line: none; cursor: pointer; word-break: break-all;"></a></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">5</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、启动</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">服务</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">net start mysql</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);"><img src="https://img-blog.csdn.net/20180713112205727?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><br style="box-sizing: border-box; outline: 0px; word-break: break-all;"/></span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">6</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">、使用生成的密码通过</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql -u root -p</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">登录，然后</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">mysql</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">通过</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">“setpassword=password(&#39;123456&#39;)”</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">修改密码。此处将</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">root</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">密码设置为</span><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 34, 34);">123456</span></p><p style="text-align:left;box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background: rgb(255, 255, 255);"><img src="https://img-blog.csdn.net/20180713112219693?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4NzkzOTU4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;"/><a href="http://files.jb51.net/file_images/article/201802/201821111948931.jpg?20181111201" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; color: rgb(103, 149, 181); text-decoration-line: none; cursor: pointer; word-break: break-all;"></a></p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin-top: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; white-space: normal; background-color: rgb(255, 255, 255);">&nbsp;</p><p><br/></p>]]></description><category>数据采集</category><comments>http://gaohualing.cn/post/重装mysql.html#comment</comments><wfw:commentRss>http://gaohualing.cn/feed.asp?cmt=38</wfw:commentRss></item></channel></rss>
