太喜欢这个粘帖功能了,直接把MARKDOWN格式粘过来了.没有之一,还有图床,也相当给力,不愧是做nlp的,编辑的福音啊.
linux 删除软链接文件
千年的塔于 2012-10-27 00:40:31 发布
4707
收藏
分类专栏: shell
42 篇文章0 订阅
订阅专栏
Linux 删除软链接文件
软链接即用 ln -s 原始文件或文件夹 目标文件或文件夹
当想删除链接文件时 如果不小新 会把原始文件删掉
例:
ln -s /home/user/bak /var/bak
rm /var/bak/ 会提示bak是一个文件夹无法删除 这时千万不要用 rm -rf /var/bak/ 来删除 否则你删除的并不是链接文件 而是真正的 /home/user/bak 文件夹
想要删除链接文件要用以下命令
rm /var/bak
只是少了一个“ / ” 删除的 就是链接文件
结论:
在删除文件时要小心
在删除软链接文件时 小心使用 Tab 建
还原被删除的 /tmp 文件夹
我在文章Linux和Unix shell,我犯了一些错误。我意外地删除了/tmp文件夹。要还原它,我需要这么做:
1
2
3
4 mkdir
/tmp
chmod
1777
/tmp
chown
root:root
/tmp
ls
-ld
/tmp
我如何删除意外在当前文件夹下解压的文件?
我意外在/var/www/html/而不是/home/projects/www/current下解压了一个tarball。它搞乱了/var/www/html下的文件,你甚至不知道哪些是误解压出来的。最简单修复这个问题的方法是:
1
2 cd
/var/www/html/
/bin/rm
-f
"$(tar ztf /path/to/file.tar.gz)"
文章知识点与官方知识档案匹配,可进一步学习相关知识
sudo update-alternatives --config python
update-alternatives: 错误: 无 python 的候选项
dpkg -L python3
/.
/usr
/usr/bin
/usr/lib
/usr/lib/valgrind
/usr/lib/valgrind/python3.supp
/usr/share
/usr/share/doc
/usr/share/doc/python3
/usr/share/doc/python3/README.Debian
/usr/share/doc/python3/changelog.Debian.gz
/usr/share/doc/python3/copyright
/usr/share/doc/python3/python-policy.dbk.gz
/usr/share/doc/python3/python-policy.html
/usr/share/doc/python3/python-policy.html/build_dependencies.html
/usr/share/doc/python3/python-policy.html/embed.html
/usr/share/doc/python3/python-policy.html/index.html
/usr/share/doc/python3/python-policy.html/module_packages.html
/usr/share/doc/python3/python-policy.html/other.html
/usr/share/doc/python3/python-policy.html/packaging_tools.html
/usr/share/doc/python3/python-policy.html/programs.html
/usr/share/doc/python3/python-policy.html/python.html
/usr/share/doc/python3/python-policy.html/python3.html
/usr/share/doc/python3/python-policy.html/upgrade.html
/usr/share/doc/python3/python-policy.txt.gz
/usr/share/doc/python3.7
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/python3
/usr/share/man
/usr/share/man/man1
/usr/share/pixmaps
/usr/share/python3
/usr/share/python3/python.mk
/usr/share/python3/runtime.d
/usr/share/python3/runtime.d/public_modules.rtinstall
/usr/share/python3/runtime.d/public_modules.rtremove
/usr/bin/pdb3
/usr/bin/pydoc3
/usr/bin/pygettext3
/usr/share/doc/python3.7/python-policy.dbk.gz
/usr/share/doc/python3.7/python-policy.html
/usr/share/doc/python3.7/python-policy.txt.gz
/usr/share/man/man1/pdb3.1.gz
/usr/share/man/man1/pydoc3.1.gz
/usr/share/man/man1/pygettext3.1.gz
/usr/share/pixmaps/python3.xpm
dpkg -L python
/.
/usr
/usr/bin
/usr/lib
/usr/lib/valgrind
/usr/share
/usr/share/apps
/usr/share/apps/konsole
/usr/share/apps/konsole/python.desktop
/usr/share/doc
/usr/share/doc/python
/usr/share/doc/python/README.Debian
/usr/share/doc/python/changelog.Debian.gz
/usr/share/doc/python/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/python
/usr/share/man
/usr/share/man/man1
/usr/share/pixmaps
/usr/bin/pdb
/usr/bin/pydoc
/usr/bin/pygettext
/usr/lib/valgrind/python.supp
/usr/share/man/man1/pdb.1.gz
/usr/share/man/man1/pydoc.1.gz
/usr/share/man/man1/pygettext.1.gz
/usr/share/pixmaps/python.xpm
ln -s python /usr/share/python3
ln: 无法创建符号链接'/usr/share/python3/python': 权限不够
pi@raspberrypi:~ $ sudo ln -s python /usr/share/python3
pi@raspberrypi:~ $ python --version
Python 2.7.16
pi@raspberrypi:~ $ python3 --version
Python 3.7.3
pi@raspberrypi:~ $ sudo ln -s python /usr/bin/python3
ln: 无法创建符号链接'/usr/bin/python3': 文件已存在
实在不顺,再试.
ls /usr/bin/py*
/usr/bin/py3clean /usr/bin/pygettext2.7 /usr/bin/python2-config
/usr/bin/py3compile /usr/bin/pygettext3 /usr/bin/python2-pbr
/usr/bin/py3versions /usr/bin/pygettext3.7 /usr/bin/python3
/usr/bin/pybuild /usr/bin/pygmentize /usr/bin/python3.7
/usr/bin/pyclean /usr/bin/pyjwt /usr/bin/python3.7-config
/usr/bin/pycompile /usr/bin/pyjwt3 /usr/bin/python3.7m
/usr/bin/pydoc /usr/bin/pylint3 /usr/bin/python3.7m-config
/usr/bin/pydoc2 /usr/bin/pypy /usr/bin/python3-config
/usr/bin/pydoc2.7 /usr/bin/pypyclean /usr/bin/python3m
/usr/bin/pydoc3 /usr/bin/pypycompile /usr/bin/python3m-config
/usr/bin/pydoc3.7 /usr/bin/pyreverse3 /usr/bin/python-config
/usr/bin/pyflakes /usr/bin/python /usr/bin/pyvenv
/usr/bin/pyflakes3 /usr/bin/python2 /usr/bin/pyvenv-3.7
/usr/bin/pygettext /usr/bin/python2.7 /usr/bin/pyversions
/usr/bin/pygettext2 /usr/bin/python2.7-config
参照: 0x03 采用update-alternatives 切换版本
详细步骤说明,如何建立选项,如何选择,怎么选择,终于输入 PYTHON 显示的PY3啦
sudo update-alternatives --config python
有 2 个候选项可用于替换 python (提供 /usr/bin/python)。
选择 路径 优先级 状态
------------------------------------------------------------
0 /usr/bin/python2.7 2 自动模式
1 /usr/bin/python2.7 2 手动模式
* 2 /usr/bin/python3.7 1 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:^C
pi@raspberrypi:~ $ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
hanlp segment
Traceback (most recent call last):
File "/home/pi/.local/bin/hanlp", line 6, in <module>
from pyhanlp.main import main
ModuleNotFoundError: No module named 'pyhanlp'
中莫会是啊
pip install pyhanlp
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyhanlp
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='www.piwheels.org', port=443): Read timed out. (read timeout=15)")': /simple/pyhanlp/
Using cached https://www.piwheels.org/simple/pyhanlp/pyhanlp-0.1.84-py3-none-any.whl
Collecting jpype1==0.7.0 (from pyhanlp)
Downloading https://www.piwheels.org/simple/jpype1/JPype1-0.7.0-cp37-cp37m-linux_armv7l.whl (2.7MB)
100% |████████████████████████████████| 2.7MB 36kB/s
Collecting hanlp-downloader (from pyhanlp)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/hanlp-downloader/hanlp_downloader-0.0.25-py3-none-any.whl
Using cached https://www.piwheels.org/simple/hanlp-downloader/hanlp_downloader-0.0.25-py3-none-any.whl
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from hanlp-downloader->pyhanlp) (2.21.0)
Installing collected packages: jpype1, hanlp-downloader, pyhanlp
Successfully installed hanlp-downloader-0.0.25 jpype1-0.7.0 pyhanlp-0.1.84
刚开始是安装到 PY2啦吗?我再安装一次.
hanlp segment
Traceback (most recent call last):
File "/usr/lib/python3.7/urllib/request.py", line 1324, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.7/http/client.py", line 1260, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 970, in send
self.connect()
File "/usr/lib/python3.7/http/client.py", line 942, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib/python3.7/socket.py", line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.local/bin/hanlp", line 6, in <module>
from pyhanlp.main import main
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/__init__.py", line 149, in <module>
_start_jvm_for_hanlp()
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/__init__.py", line 41, in _start_jvm_for_hanlp
from pyhanlp.static import STATIC_ROOT, hanlp_installed_data_version, HANLP_DATA_PATH
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/__init__.py", line 285, in <module>
install_hanlp_jar()
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/__init__.py", line 160, in install_hanlp_jar
jar_version, jar_url, data_version, data_url = hanlp_latest_version()
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/__init__.py", line 71, in hanlp_latest_version
return hanlp_releases()[0]
File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/__init__.py", line 83, in hanlp_releases
content = urllib.urlopen(req).read()
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1352, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.7/urllib/request.py", line 1326, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -5] No address associated with hostname>
这回看着正常了.好像是网络链接不通,不会需要饭强吧.苦恼了.
hanlp segment
下载 https://file.hankcs.com/hanlp/hanlp-1.8.3-release.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/hanlp-1.8.3-release.zip
这又是什么操作呢?
下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip
这个呢?这是准备数据集吗?
这是假死了吗?
^C下载失败 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 由于 KeyboardInterrupt()
请参考 https://od.hankcs.com/book/intro_nlp/ 执行手动安装.
或手动下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip
是否前往 https://od.hankcs.com/book/intro_nlp/ ?(y/n)
看版本号,1.7的,不会删除了吧.这叫一个转啊.
安装pyhanlp
pip install pyhanlp
1
安装后在第一次使用时,当运行from pyhanlp import *时,会下载hanlp的数据文件,这个文件比较大,一般都会下载失败,推荐手动下载并放到要求的路径下。
data文件下载地址:Releases · hankcs/HanLP · GitHub
在页面中下载data-for-1.7.2.zip
然后把下载的文件放到C:\Anaconda3\Lib\site-packages\pyhanlp\static 目录下
再执行from pyhanlp import *,完成自动解压。
————————————————
版权声明:本文为CSDN博主「Ezrealmore」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:【NLP】pyhanlp的安装与使用_Ezrealmore的博客-CSDN博客_python 安装pyhanlp
v1.8.3 常规维护
- 修复动态自定义词典与CustomDictionaryForcing的搭配问题 fix #1712
- 调整
莎=sha1,suo1
fix #1670 - 根据总词频动态决定未登录词的默认词频
- DoubleArrayTrie里的LongestSearcher的next支持null作为值 by @tiandiweizun in #1674
- Update DoubleArrayTrie.java的注释 by @TITC in #1699
- 数据包兼容data-for-1.7.5.zip
md5=1d9e1be4378b2dbc635858d9c3517aaa
- Portable版同步升级到v1.8.3
com.hankcs hanlp portable-1.8.3
Full Changelog: v1.8.2…v1.8.3
啊哦,你来晚了,分享的文件已经被取消了,下次要早点哟。
会员加速都无济于事啊!
https://file.hankcs.com/hanlp/data-for-1.7.5.zip 这个网站虽然时不时被DDoS,但也不至于这么慢。请贴一下你的宽带运营商,我们再想想办法。
你也可以试试镜像站:https://od.hankcs.com/hanlp/data/data-for-1.7.5.zip
最后还是求助迅雷多线程,几个小时下载下来了。
653M,必须给同学们预警下。