module 'pip' has no attribute 'main'

Mac: python2.7 和 python3.6 都有安装。
一开始把pip更新到18.0后,用下面的指令装一个scrapy的包,遇到如题error

pip install scrapy

最终用如下方式解决:

python3 -m pip install scrapy

如果查看python3下所有安装包

python3 -m pip list

Python中PyMySQL提示AttributeError: module 'socket' has no attribute 'AF_UNIX'

09-11

代码如下:rnfrom urllib.request import urlopenrnfrom bs4 import BeautifulSouprnimport rernimport datetimernimport randomrnimport pymysqlrnrnconn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock',rn user='root', passwd=None, db='mysql', charset='utf8')rncur = conn.cursor()rncur.execute("USE scraping")rnrnrandom.seed(datetime.datetime.now())rnrndef store(title, content):rn cur.execute("INSERT INTO pages (title, content) VALUES (\"%s\",\rn \"%s\")", (title, content))rn cur.connection.commit()rn rndef getLinks(articleUrl):rn html = urlopen("http://en.wikipedia.org"+articleUrl)rn bsObj = BeautifulSoup(html)rn title = bsObj.find("h1").get_text()rn content = bsObj.find("div", "id":"mw-content-text").find("p").get_text()rn store(title, content)rn return bsObj.find("div", "id":"bodyContent").findAll("a",rn href=re.compile("^(/wiki/)((?!:).)*$"))rnlinks = getLinks("/wiki/Kevin_Bacon")rntry:rn while len(links) > 0:rn newArticle = links[random.randint(0, len(links)-1)].attrs["href"]rn print(newArticle)rn links = getLinks(newArticle)rnfinally:rn cur.close()rn conn.close()rnrn编译后提示错误:rnTraceback (most recent call last):rn File "F:\爬虫\17-9-11.py", line 9, in rn user='root', passwd=None, db='mysql', charset='utf8')rn File "F:\Python 3.6\lib\site-packages\pymysql\__init__.py", line 90, in Connectrn return Connection(*args, **kwargs)rn File "F:\Python 3.6\lib\site-packages\pymysql\connections.py", line 706, in __init__rn self.connect()rn File "F:\Python 3.6\lib\site-packages\pymysql\connections.py", line 903, in connectrn sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)rn[color=#FF0000]AttributeError: module 'socket' has no attribute 'AF_UNIX'[/color]

执行:scrapy startproject test 出错 'module' object has no attribute 'OP_NO_TLSv1_1'

03-14

Traceback (most recent call last):rn File "d:\users\july_whj\lib\runpy.py", line 174, in _run_module_as_mainrn "__main__", fname, loader, pkg_name)rn File "d:\users\july_whj\lib\runpy.py", line 72, in _run_codern exec code in run_globalsrn File "D:\Users\July_whj\Scripts\scrapy.exe\__main__.py", line 5, in rn File "d:\users\july_whj\lib\site-packages\scrapy\cmdline.py", line 9, in rn from scrapy.crawler import CrawlerProcessrn File "d:\users\july_whj\lib\site-packages\scrapy\crawler.py", line 7, in rn from twisted.internet import reactor, deferrn File "d:\users\july_whj\lib\site-packages\twisted\internet\reactor.py", line 38, in rn from twisted.internet import defaultrn File "d:\users\july_whj\lib\site-packages\twisted\internet\default.py", line 56, in rn install = _getInstallFunction(platform)rn File "d:\users\july_whj\lib\site-packages\twisted\internet\default.py", line 50, in _getInstallFunctionrn from twisted.internet.selectreactor import installrn File "d:\users\july_whj\lib\site-packages\twisted\internet\selectreactor.py", line 18, in rn from twisted.internet import posixbasern File "d:\users\july_whj\lib\site-packages\twisted\internet\posixbase.py", line 18, in rn from twisted.internet import error, udp, tcprn File "d:\users\july_whj\lib\site-packages\twisted\internet\tcp.py", line 28, in rn from twisted.internet._newtls import (rn File "d:\users\july_whj\lib\site-packages\twisted\internet\_newtls.py", line 21, in rn from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocolrn File "d:\users\july_whj\lib\site-packages\twisted\protocols\tls.py", line 63, in rn from twisted.internet._sslverify import _setAcceptableProtocolsrn File "d:\users\july_whj\lib\site-packages\twisted\internet\_sslverify.py", line 38, in rn TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,rn[img=http://img.bbs.csdn.net/upload/201703/14/1489472407_473975.png][/img]

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

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试