不就是装个包?老练得不像是小萌新的我,非常熟练地win+r,输入cmd,输入pip install gensim.models
结果,什么?!报错了?果然windows对python不是很友好、生气脸.jpg。
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
这个意思大概是我的pip版本太老了吧,我也没有搁置python很久啊,突然进化到18.0的版本、、喂喂程序员要不要这么拼啊
按照提示输入python -m pip install --upgrade pip
还来?顽强地报错:
PermissionError: [WinError 5] 拒绝访问。: 'c:\\program files (x86)\\microsoft visual studio\\shared\\anaconda3_64\\lib\\site-packages\\pip\\basecommand.py'
这一次是访问权限地问题,嘲笑我没有权限?wtf?我可是买了电脑的人啊!尝试了一下sudo、没用、好吧那个是linux的。csdn大神说要加–user:python -m pip install --user--upgrade pip
emmm这个大神还行吧、貌似差了一点点
Installing collected packages: pip
Successfully installed pip-18.0
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
在我的搜罗下,找到了正确答案:python -m pip install -U pip
C:\Users\95yyl11>python -m pip install -U pip
Requirement already up-to-date: pip in c:\users\95yyl11\appdata\roaming\python\python36\site-packages (18.0)
嘻嘻~~~心情大好
gensim包、、貌似挺有名的,里面有个Word2Vec
升级装备就要打怪了,没想到安装gensim也麻烦、、
头疼。再一次老练地输入:pip install --user gensim.models
结果报错了、、??咋升级的pip反而不好使了呢、、、
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts\pip-script.py", line 6, in
from pip import main
ImportError: cannot import name 'main'
stackoverflow大神说,改pip的内容:
进入 /usr/bin/pip把
from pip import main
if __name__ == '__main__':
sys.exit(main())
改成
from pip import __main__
if __name__ == '__main__':
sys.exit(__main__._main())
鉴于小萌新觉得这个好难、还是曲线救国吧
另外一个stackoverflow上的真·大神说新的pip里面有一个main函数,所以不能再用老的pip install,而要用python -m pip install gensim.model
这种形式?虽然不是很懂,但是很好用、虽然报错、但是离成功进了一步:
Collecting gensim.model
Could not find a version that satisfies the requirement gensim.model (from versions: )
No matching distribution found for gensim.model
哈哈,可能是只能安装gensim,python -m pip install gensim
,可以了,离成功很近了,进度条在加载了~
Downloading https://files.pythonhosted.org/packages/a9/78/7f51f0d83f23ced1a951aa9db5873829d9b03ac351dcdb3e7c4d5f002c0d/gensim-3.5.0-cp36-cp36m-win_amd64.whl (23.5MB)
13% |████▌ | 3.2MB 103kB/s eta 0:03:15
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
加载到一半崩了?Read timed out.??就tm是因为我刷了一下淘宝占用了网速吗???正经脸.jpg
查询csdn大神的解决方案pip --default-timeout=1000 install -U pip
这个timeout在没改之前是100来着的
哈哈出现一段来自妲己的温馨提示:
Requirement already up-to-date: pip in c:\users\95yyl11\appdata\roaming\python\python36\site-packages (18.0)
好的,紧接着:python -m pip install gensim
有戏!进度条缓慢加载到100%,可是本废柴忘记之前的教训了,没有权限、、
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Anaconda3_64\\Lib\\site-packages\\bz2file.py'
Consider using the `--user` option or check the permissions.
哈哈不就是加个–user!我仿佛看到了胜利的曙光!python -m pip install --user gensim
Installing collected packages: jmespath, botocore, s3transfer, boto3, bz2file, smart-open, gensim
Successfully installed boto3-1.9.7 botocore-1.12.7 bz2file-0.98 gensim-3.5.0 jmespath-0.9.3 s3transfer-0.1.13 smart-open-1.7.1
嘻嘻,还不错吧~~,所以正确答案是:
pip --default-timeout=1000 install -U pip
python -m pip install --user gensim
好了这么麻烦、、主要是我可怜的小conda是用visual studio下载的、、、python3又不在conda里面、是另立门户的~
所以往我的conda里面投喂一个包真的好麻烦哦