我发现在威联通上面使用 Python3 还挺麻烦的。即使我已经在 App Center 里面安装好了,但是当我通过 ssh 连接威联通 nas 时,却发现找不到 Python3,Python2 倒是可以找到。
[~] # python3 -sh: python3: command not found [~] # python Python 2.7.13 (default, Mar 24 2022, 10:03:40) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
那问题来了。
安装好的 Python3 在哪里呢?
答:在 /share/CACHEDEV1_DATA/.qpkg/Python3
[/share/CACHEDEV1_DATA/.qpkg/Python3] # ls python3/ python3.bash Python3.sh* README.md src/
那要如何使用它呢?
通过查看 README.md 的内容,我们可以看到这些内容
# cat README.md Run the following command to enter Python3 environment:
[/share/CACHEDEV1_DATA/.qpkg/Python3] # . /etc/profile.d/python3.bash [/share/CACHEDEV1_DATA/.qpkg/Python3] # python3 Python 3.10.4 (main, May 6 2022, 08:22:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
进阶了解
其实这里的 . 也可以换为 source,它们是等价的。
[~] # python3 -sh: python3: command not found [~] # source /etc/profile.d/python3.bash [~] # python3 Python 3.10.4 (main, May 6 2022, 08:22:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
评论(0)