與SUSE12的服務(wù)器部署的那些事。
-2、虛擬機(jī)安裝,參考:suse12 sp4,sp5 鏡像資源分享 | 程序園 (program-park.top)
-1、下個(gè)免費(fèi)版的moba,夠用了,方便上傳下載文件,只因我這邊vmware的tool沒(méi)有生效。MobaXterm Xserver with SSH, telnet, RDP, VNC and X11 - Home Edition (mobatek.net)
插曲:YaST Software Management - openSUSE Wiki SUSE有一個(gè)Yast工具,可以安裝一些基礎(chǔ)的庫(kù),可能會(huì)用到。
0、部署python3,去官網(wǎng)python.org下載python,然后參考:SUSE12 離線安裝python - 走看看 (zoukankan.com)安裝python,但是,不會(huì)那么順利。
- 會(huì)出現(xiàn)各種問(wèn)題,比如:
/home/kyo/桌面/Python-3.8.17/Modules/_ctypes/_ctypes.c:107:17: 致命錯(cuò)誤:ffi.h:沒(méi)有那個(gè)文件或目錄
#include <ffi.h>
^
編譯中斷。
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _hashlib
_lzma _sqlite3 _ssl
_tkinter _uuid readline
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc atexit pwd
time
Failed to build these modules:
_ctypes
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/38
解決方法:使用rpm安裝libffi4和libffi:suse官方 devel:gcc / libffi4 (opensuse.org)和可選libffi安裝
另附:zlib下載鏈接:http://www.zlib.net/fossils/zlib-1.2.11.tar.gz
參考:linux 中 devel包 和 非devel包的區(qū)別 - 知乎 (zhihu.com)
(3條消息) ppc64,ppc64le,ARM,AMD,X86,i386,x86_64(AMD64),AArch64的概念_Lay_Nobody的博客-CSDN博客
(3條消息) CentOS7 離線安裝 Python_libffi-devel離線安裝_v空空的博客-CSDN博客
RPM包安裝 · Linux教程 · 看云 (kancloud.cn)
再進(jìn)行編譯,編譯會(huì)出現(xiàn)缺庫(kù)的問(wèn)題,對(duì)癥下藥,補(bǔ)全對(duì)應(yīng)的庫(kù)就可以。
注意:此時(shí)如果使用pip的話,會(huì)提示SSL之類(lèi)的問(wèn)題,安裝庫(kù)指定的倉(cāng)庫(kù)只能是http的。參考這篇,使用阿里云解決 :(3條消息) 【日常踩坑】解決 pip 安裝第三方包時(shí)因 SSL 報(bào)錯(cuò)_pip ssl_ywang_wnlo的博客-CSDN博客
)
- 此時(shí),如果直接pip install playwright,當(dāng)前會(huì)安裝1.35版本,后續(xù)運(yùn)行,可能會(huì)出現(xiàn)需要GLIBC的某些版本,比如:
/home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node)
/home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node)
/home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /home/kyo/.local/lib/python3.8/site-packages/playwright/driver/node)
Traceback (most recent call last):
File "test.py", line 4, in <module>
with sync_api.sync_playwright() as p:
File "/home/kyo/.local/lib/python3.8/site-packages/playwright/sync_api/_context_manager.py", line 94, in __enter__
playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'
Task was destroyed but it is pending!
此時(shí),解決方案有兩個(gè)(后者簡(jiǎn)單直接):
- 此時(shí)如果直接升級(jí)GLIBC,會(huì)出現(xiàn)覆蓋本地GLIBC的問(wèn)題,也可以換個(gè)路徑裝,但是裝完之后,不知道后續(xù)怎么處理(參考:OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by xxx.so) ——升級(jí)GLIBC并解決系統(tǒng)錯(cuò)誤 - 知乎 (zhihu.com)
),其中:
- 更新glibc前,需要更新gcc和make,會(huì)出現(xiàn)gcc和make版本過(guò)老的問(wèn)題,需要升級(jí)gcc和make。(更新gcc和make的內(nèi)容參考:(3條消息) These critical programs are missing or too old: make compiler_Dan淡淡的心的博客-CSDN博客
-----------(3條消息) configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+._請(qǐng)叫我大蝦的博客-CSDN博客
推薦從阿里云下載相應(yīng)的代碼:gnu-make安裝包下載_開(kāi)源鏡像站-阿里云 (aliyun.com)
)
- 降級(jí)playwright,由于本地開(kāi)發(fā)的時(shí)候使用的1.35版本的playwright codegen,生成的代碼存在一些新版本的api。因此,降級(jí)到對(duì)應(yīng)api出現(xiàn)的版本,這里選擇的是1.27。
最后的運(yùn)行階段:
1、安裝playwright支持版本的chromium(CNPM Binaries Mirror (npmmirror.com)
自己找對(duì)應(yīng)自己需要的版本。)
參考:Linux Zip文件解壓教程|極客筆記 (deepinout.com)
2、在運(yùn)行playwright的相關(guān)python代碼的時(shí)候,指定execution_path,來(lái)指定瀏覽器的運(yùn)行路徑,使用headless來(lái)指定瀏覽器是否以非GUI方式運(yùn)行
本地安裝參考:python+playwright 學(xué)習(xí)-42 離線安裝 playwright 環(huán)境 - 上海-悠悠 - 博客園 (cnblogs.com)