내 Debian-Jessie 컴퓨터에 GNS3(네트워크 에뮬레이터)를 설치했지만 프로그램을 시작하려고 하면 다음 오류가 발생합니다:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
왜 이런 일이 발생하는지 아시나요?
도움이 될까봐 추적도 해봤습니다.
/usr/lib$strace /usr/bin/gns3
execve("/usr/bin/gns3", ["/usr/bin/gns3"], [/* 38 vars */]) = 0
brk(NULL) = 0x1115000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe93573f000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=183999, ...}) = 0
mmap(NULL, 183999, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe935712000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0a\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=135744, ...}) = 0
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe935301000
mprotect(0x7fe935319000, 2093056, PROT_NONE) = 0
mmap(0x7fe935518000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fe935518000
mmap(0x7fe93551a000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe93551a000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\10\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1697504, ...}) = 0
mmap(NULL, 3803552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934f60000
mprotect(0x7fe9350f7000, 2097152, PROT_NONE) = 0
mmap(0x7fe9352f7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x197000) = 0x7fe9352f7000
mmap(0x7fe9352fd000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe9352fd000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14640, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe935711000
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934d5c000
mprotect(0x7fe934d5e000, 2097152, PROT_NONE) = 0
mmap(0x7fe934f5e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fe934f5e000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libutil.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=10688, ...}) = 0
mmap(NULL, 2105608, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934b59000
mprotect(0x7fe934b5b000, 2093056, PROT_NONE) = 0
mmap(0x7fe934d5a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fe934d5a000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libexpat.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0;\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=166032, ...}) = 0
mmap(NULL, 2261096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934930000
mprotect(0x7fe934956000, 2097152, PROT_NONE) = 0
mmap(0x7fe934b56000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7fe934b56000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \"\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=109144, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe935710000
mmap(NULL, 2204200, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934715000
mprotect(0x7fe93472f000, 2093056, PROT_NONE) = 0
mmap(0x7fe93492e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7fe93492e000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pU\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1067424, ...}) = 0
mmap(NULL, 3162344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe934410000
mprotect(0x7fe934514000, 2093056, PROT_NONE) = 0
mmap(0x7fe934713000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x103000) = 0x7fe934713000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe93570f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe93570e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe93570d000
arch_prctl(ARCH_SET_FS, 0x7fe93570e700) = 0
mprotect(0x7fe9352f7000, 16384, PROT_READ) = 0
mprotect(0x7fe934713000, 4096, PROT_READ) = 0
mprotect(0x7fe93492e000, 4096, PROT_READ) = 0
mprotect(0x7fe934b56000, 8192, PROT_READ) = 0
mprotect(0x7fe934d5a000, 4096, PROT_READ) = 0
mprotect(0x7fe934f5e000, 4096, PROT_READ) = 0
mprotect(0x7fe935518000, 4096, PROT_READ) = 0
mprotect(0x8fd000, 4096, PROT_READ) = 0
mprotect(0x7fe935741000, 4096, PROT_READ) = 0
munmap(0x7fe935712000, 183999) = 0
set_tid_address(0x7fe93570e9d0) = 30088
set_robust_list(0x7fe93570e9e0, 24) = 0
rt_sigaction(SIGRTMIN, {0x7fe935306ba0, [], SA_RESTORER|SA_SIGINFO, 0x7fe935311ed0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7fe935306c30, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fe935311ed0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
brk(NULL) = 0x1115000
brk(0x1136000) = 0x1136000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1668976, ...}) = 0
mmap(NULL, 1668976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe935575000
close(3) = 0
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0
mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7fe935738000
close(3) = 0
futex(0x7fe9352fc8c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
read(3, "\277\310\6}\261\210\337\236\5\227\353\273\201M\20x\363:\220Q\226H\251>", 24) = 24
close(3) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe9343d0000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe934390000
brk(0x1157000) = 0x1157000
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 7), ...}) = 0
readlink("/usr/share/gns3/gns3-gui/bin/python", "python3", 4096) = 7
readlink("/usr/share/gns3/gns3-gui/bin/python3", 0x7fffc1cc4220, 4096) = -1 EINVAL (Invalid argument)
open("/usr/share/gns3/gns3-gui/bin/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/gns3/gns3-gui/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/bin/Modules/Setup", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/bin/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/bin/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/os.py", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/os.pyc", 0x7fffc1cc51a0) = -1 ENOENT (No such file or directory)
write(2, "Could not find platform independ"..., 55Could not find platform independent libraries <prefix>
) = 55
stat("/usr/share/gns3/gns3-gui/bin/pybuilddir.txt", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/bin/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/gns3-gui/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/gns3/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/lib-dynload", 0x7fffc1cc51b0) = -1 ENOENT (No such file or directory)
write(2, "Could not find platform dependen"..., 58Could not find platform dependent libraries <exec_prefix>
) = 58
write(2, "Consider setting $PYTHONHOME to "..., 57Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
) = 57
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe934350000
brk(0x1178000) = 0x1178000
sysinfo({uptime=2240881, loads=[86848, 87776, 71104], totalram=8275865600, freeram=282087424, sharedram=0, bufferram=84557824, totalswap=0, freeswap=0, procs=622, totalhigh=0, freehigh=0, mem_unit=1}) = 0
brk(0x119a000) = 0x119a000
sigaltstack({ss_sp=0x1179700, ss_flags=0, ss_size=8192}, NULL) = 0
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("/usr/lib/python3.4/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
getdents(3, /* 3 entries */, 32768) = 80
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
stat("/usr/lib/python3.4/plat-x86_64-linux-gnu", 0x7fffc1cd62c0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
stat("/usr/lib/python3.4/plat-x86_64-linux-gnu", 0x7fffc1cd5ca0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/lib-dynload", 0x7fffc1cd62c0) = -1 ENOENT (No such file or directory)
stat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=36864, ...}) = 0
stat("/usr/lib/lib-dynload", 0x7fffc1cd5ca0) = -1 ENOENT (No such file or directory)
write(2, "Fatal Python error: Py_Initializ"..., 69Fatal Python error: Py_Initialize: Unable to get the locale encoding
) = 69
write(2, "ImportError", 11ImportError) = 11
write(2, ": ", 2: ) = 2
write(2, "No module named 'encodings'", 27No module named 'encodings') = 27
write(2, "\n", 1
) = 1
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(30088, 30088, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=30088, si_uid=1000} ---
+++ killed by SIGABRT +++
Aborted
또한 다음과 같이 PYTHONHOME 설정을 시도했지만 여전히 운이 없습니다.
user@station:~$which python
/usr/bin/python
user@station:~$export PYTHONHOME=/usr/bin
user@station:~$echo $PYTHONHOME
/usr/bin
user@station:~$gns3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
답변1
노력하다 export PYTHONHOME=/usr/bin
. Python은 Debian에 설치되어 있어야 합니다 /usr/bin
.
그렇지 않은 경우 which python
반환되는 디렉터리를 실행하고 사용합니다.export PYTHONHOME=<directory>
편집하다
그것도 시도해 보세요 export PYTHONPATH=/usr/lib/python2.7
.
이 작업을 수행하기 전에 디렉터리가 실제로 존재하는지 확인하세요. Python 버전에 따라 다르지만 모듈이 저장되는 위치여야 합니다.
더 나은 방법은 다음으로 바꾸는 대신 추가하는 것입니다.
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7
답변2
오늘도 같은 문제가 발생했습니다. 아직까지 해결책을 찾지 못했는데 어떻게 해결했는지 알려드리겠습니다.
먼저 배포판에 따라 gns3 설치를 정리하십시오. 저는 데비안을 사용하고 있으므로 다음 명령을 사용했습니다: $sudo apt-get autoremove --purge gns3*
2. gns3 공식 웹사이트에 접속하세요:https://docs.gns3.com/1QXVIihk7dsOL7Xr7Bmz4zRzTsJ02wklfImGuHwTlaA4/새 gns3 버전 설치를 따르세요.