Open gaowenxin95 opened 4 years ago
类似于pip安装jieba,jieba也可以通过python setup.py install 方式安装,最后可以通过import这个jieba模块使用
''' git clone ***jieba.git cd jieba python setup.py install ''' 完成后调用 test_jieba.py
''' import jieba
print(jieba.cut(text)) '''
(base) C:\Windows\system32>pip install tweepy
Collecting tweepy
Downloading tweepy-3.8.0-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: requests-oauthlib>=0.7.0 in d:\anaconda3\lib\site-packages (from tweepy) (1.3.0)
Requirement already satisfied: six>=1.10.0 in d:\anaconda3\lib\site-packages (from tweepy) (1.14.0)
Requirement already satisfied: PySocks>=1.5.7 in d:\anaconda3\lib\site-packages (from tweepy) (1.6.8)
Requirement already satisfied: requests>=2.11.1 in d:\anaconda3\lib\site-packages (from tweepy) (2.23.0)
Requirement already satisfied: oauthlib>=3.0.0 in d:\anaconda3\lib\site-packages (from requests-oauthlib>=0.7.0->tweepy) (3.1.0)
Requirement already satisfied: idna<3,>=2.5 in d:\anaconda3\lib\site-packages (from requests>=2.11.1->tweepy) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\anaconda3\lib\site-packages (from requests>=2.11.1->tweepy) (1.25.8)
Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda3\lib\site-packages (from requests>=2.11.1->tweepy) (2019.11.28)
Requirement already satisfied: chardet<4,>=3.0.2 in d:\anaconda3\lib\site-packages (from requests>=2.11.1->tweepy) (3.0.4)
Installing collected packages: tweepy
Successfully installed tweepy-3.8.0
(base) C:\Windows\system32>cd ..
(base) C:\Windows>cd ..
(base) C:\>cd /d d:
(base) D:\>cd D:/JupyterNotebook/work/analysis
(base) D:\JupyterNotebook\work\analysis>python seg_words.py install
(base) D:\JupyterNotebook\work\analysis>
测试用例调试
老大你看一下,没问题我close了
@snakecy
大致意思是的,就是这个依赖是需要在安装seg_words工程的时候,自动安装,setup.py这个文件里面需要配置,完整工程地址是?
大致意思是的,就是这个依赖是需要在安装seg_words工程的时候,自动安装,setup.py这个文件里面需要配置,完整工程地址是?
我这里好像没没配置setup.py,就直接安装了seg_words.py
还需要额外配置setup.py?
@snakecy
昨天安装re和jieba报错是因为我这边之前安装过,我今天换了一个没安装过的,没有报错。修改setup里面install_requires这个参数就可以了:
https://github.com/gaowenxin95/seg_words/blame/master/setup.py#L11
[ ] build文件可删除,不会报错,本地测试了
[ ] __init__.py参数设置可以参考这个notes:https://gaowenxin95.github.io/le_python_pks/py_pks.html
[ ] 预训练模型路径问题
把路径拿出来作为一个参数,放到函数参数定义,然后自己设置自己的路径
@snakecy
我直接使用sys.path了,可以import导入后使用,但是只能我自己本地使用
本地调用例子:https://github.com/gaowenxin95/work/blob/master/analysis/import-demo.ipynb 测试函数:https://github.com/gaowenxin95/work/blob/master/analysis/seg_words.py
@snakecy