win,各种python包的安装历程……

win10-cpu

快捷键:win+R,输入cmd,然后开始吧~

keras-cpu

pip install keras
# Successfully installed keras-2.2.4 keras-applications-1.0.6 keras-preprocessing-1.0.5

tensorflow-cpu

pip install --upgrade tensorflow

sklearn

pip install sklearn
# Successfully installed sklearn-0.0

GIT

下载地址:Git for Windows 2.12.1

安装教程:Windows10下安装Git

其他:

(1)cmd 里面运行git提示“不是内部或外部命令,也不是可运行的程序”:

# 配置环境变量:
D:\Program Files\Git\mingw64\bin
D:\Program Files\Git\mingw64\libexec\git-core

(2)fatal: Not a git repository

git init
# 也就是说,在命令行敲入git init回车之后,再重新执行添加文件的命令即可。

pyltp

HIT-SCIR/pyltp

第一次尝试:

pip install pyltp
# 结果:
# error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

第二、三次尝试:

由于pyltp安装时报错,需要Visual C++14.0的编译环境,因此首先电脑中需要先安装VC++14.0,对应的VS版本为VS2015。参考VS2015安装教程(带图解+下载地址+超详细)进行安装。

pip install pyltp
# 结果
# error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

下载并安装对应的ecos包(下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#ecos

pip install D:\Tencent\ecos-2.0.7.post1-cp35-cp35m-win_amd64.whl
# Successfully installed ecos-2.0.7.post1

# 结果依然:
pip install pyltp
# error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

第四次尝试:

参考:Python3.6.3中pyltp的安装错误总结

set STATICBUILD=true && python -m pip install pyltp==0.1.9.1
# Successfully installed pyltp-0.1.9.1

成功安装后下载模型(随便存放在哪里,但是使用时要调用模型地址的,可以统一存放在MODELDIR = "D:/Anaconda3/Lib/site-packages/pyltp-0.1.9.1.dist-info/ltp_data_v3.4.0"):

地址:http://ltp.ai/download.html

注:3.4.0 版本 SRL模型 pisrl.model 如在windows系统下不可用,可以到 此链接 下载支持windows的语义角色标注模型。

pymysql

whl地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#Mysqlclient

# 第一次:
pip install mysqlclient

# 第二次:(先下载whl文件)
pip install D:\Tencent\mysqlclient-1.3.13-cp35-cp35m-win_amd64.whl
# Successfully installed mysqlclient-1.3.13

pytorch

https://pytorch.org/#pip-install-pytorch

conda install pytorch-cpu torchvision-cpu -c pytorch
# 结果
>>> import pytorch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pytorch'

# 我真愚蠢,应该:
>>> import torch

gensim

https://radimrehurek.com/gensim/install.html

conda install -c conda-forge gensim

python-Levenshtein

pip install python-Levenshtein

textrank4zh

pip install textrank4zh

fasttext

whl地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#fasttext

# 第一次:先下载whl放至文件夹下(D:\..文件夹地址..\fasttext-0.8.22-cp35-cp35m-win_amd64.whl)
pip install D:\Tencent/fasttext-0.8.22-cp35-cp35m-win_amd64.whl
# 结果:socket.timeout: The read operation timed out

# 第二次:设置超时时间
pip --default-timeout=100 install D:\软件\开发工具\whl\fasttext-0.8.22-cp35-cp35m-win_amd64.whl
# Successfully installed fasttext-0.8.22 pybind11-2.2.4

pyhanlp

hankcs/pyhanlp

pip install pyhanlp
# Successfully installed jpype1-0.6.3 pyhanlp-0.1.44

# 下载hanlp的安装包:
# 第一次:import pyhanlp   #它会自动下载jar包、data文件和properties文件到默认的目录
# 结果:No such file or directory: 'D:\\Anaconda3\\lib\\site-packages\\pyhanlp\\static\\hanlp-1.7.1-release.zip

# 第二次:手动下载:https://github.com/hankcs/HanLP/
1、下载:data.zip
2、下载jar和配置文件:hanlp-release.zip
# 结果:github-production-release-asset-2e65be.s3.amazonaws.com 意外终止了连接。
# 解决:将网址复制粘贴到他处后,将前https改为http再前往下载

# 第三次:import pyhanlp后
# 结果:jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
# 解决:下载jdk文件并配置环境变量
下载教程:https://jingyan.baidu.com/article/25648fc14849779191fd00fd.html
安装和配置环境变量教程:https://jingyan.baidu.com/article/f96699bb163475894e3c1be4.html

https://github.com/hankcs/HanLP/

tqdm

pip install tqdm
# Successfully installed tqdm-4.29.1

scrapy

先安装Twisted,whl地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

pip install D:\软件\开发工具\whl\Twisted-18.9.0-cp35-cp35m-win_amd64.whl
# Successfully installed PyDispatcher-2.0.5 cssselect-1.0.3 parsel-1.5.1 pyasn1-modules-0.2.3 queuelib-1.5.0 scrapy-1.5.1 service-identity-18.1.0 w3lib-1.20.0

pip install scrapy
# Successfully installed PyDispatcher-2.0.5 cssselect-1.0.3 parsel-1.5.1 pyasn1-modules-0.2.3 queuelib-1.5.0 scrapy-1.5.1 service-identity-18.1.0 w3lib-1.20.0

synonyms

huyingxi/Synonyms

## 第一次:
pip install -U synonyms
# 结果:
# Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately # determine which files belong to it which would lead to only a partial uninstall.
# 解决:
pip install six --upgrade --ignore-installed six
# Successfully installed six-1.12.0

## 第二次:
pip install -U synonyms
# 结果:
# Cannot uninstall 'scikit-learn'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
# 解决:
pip install --ignore-installed  scikit-learn
# Successfully installed numpy-1.15.4 scikit-learn-0.20.2 scipy-1.2.0

## 第三次:
pip install -U synonyms
# Successfully installed scikit-learn-0.19.1 scipy-1.0.0 synonyms-3.10.1

猜你喜欢

转载自blog.csdn.net/imsuhxz/article/details/86466007