배경
저는 Python3.11.1과 함께 제공되는 Kali Linux 2023.1을 새로 설치하여 사용하고 있습니다. python3
python3.8과 python3.10 사이의 버전에 해당 하는 MobSF를 설치해야 합니다 .
그래서 pyenv 를 설치 3.9.5
하고 pyenv install -v 3.9.5
. pyenv global 3.9.5
그런 다음 그것을 실행 python3 --version
하고 얻었습니다 permission denied
.
그래서 저는 update-alternatives
이 새로운 설치에 python3.9.5
기본값을 사용하기로 결정했습니다. 다음 명령을 실행했습니다.
sudo update-alternatives --install /usr/bin/python3 python3 /home/user/.pyenv/versions/3.9.5/bin 1
그런 다음 나는 sudo update-alternatives --config python3
그것을 실행하여 나에게 주었다.
└─$ sudo update-alternatives --config python3
[sudo] password for user:
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.11 1 auto mode
1 /home/user/.pyenv/versions/3.9.5/bin 1 manual mode
2 /usr/bin/python3.11 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
나는 들어갔다1
.
이제 실행 sudo update-alternatives --config python3
하면
└─$ sudo update-alternatives --config python3
[sudo] password for user:
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
0 /home/user/.pyenv/versions/3.9.5/bin 1 auto mode
* 1 /home/user/.pyenv/versions/3.9.5/bin 1 manual mode
2 /usr/bin/python3.11 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
질문
이제 실행 python3 -V
하면
┌──(user㉿kali)-[~]
└─$ python3 -V
zsh: permission denied: python3
┌──(user㉿kali)-[~]
└─$ sudo python3 -V
[sudo] password for user:
sudo: python3: command not found
이제 나는 무엇을 해야할지 모르겠습니다. 누구든지 나를 안내해 주실 수 있나요?
자세한 내용은 댓글로
논평: 그럼 거기에 문서가 있나요? /home/user/.pyenv/versions/3.9.5/bin/python3을 사용하도록 시스템에 지시했습니다. 이것이 존재합니까? 시행될 수 있나요?
다음은 /home/user/.pyenv/versions/3.9.5/bin/의 상황입니다.
┌──(user㉿kali)-[~/.pyenv/versions/3.9.5/bin]
└─$ ls -al
total 116
drwxrwxrwx 2 user user 4096 Apr 28 07:10 .
drwxrwxrwx 6 user user 4096 Apr 28 03:24 ..
lrwxrwxrwx 1 user user 8 Apr 28 03:24 2to3 -> 2to3-3.9
-rwxrwxrwx 1 user user 127 Apr 28 03:24 2to3-3.9
lrwxrwxrwx 1 user user 7 Apr 28 03:24 idle -> idle3.9
lrwxrwxrwx 1 user user 7 Apr 28 03:24 idle3 -> idle3.9
-rwxrwxrwx 1 user user 125 Apr 28 03:24 idle3.9
lrwxrwxrwx 1 user user 6 Apr 28 03:24 pip -> pip3.9
-rwxrwxrwx 1 user user 255 Apr 28 03:24 pip3
-rwxrwxrwx 1 user user 255 Apr 28 03:24 pip3.9
lrwxrwxrwx 1 user user 8 Apr 28 03:24 pydoc -> pydoc3.9
lrwxrwxrwx 1 user user 8 Apr 28 03:24 pydoc3 -> pydoc3.9
-rwxrwxrwx 1 user user 110 Apr 28 03:24 pydoc3.9
lrwxrwxrwx 1 user user 9 Apr 28 03:24 python -> python3.9
lrwxrwxrwx 1 root root 25 Mar 13 08:18 python3 -> /etc/alternatives/python3
-rwxrwxrwx 1 user user 17576 Apr 28 03:23 python3.9
-rwxrwxrwx 1 user user 3111 Apr 28 03:24 python3.9-config
-rwxrwxrwx 1 user user 65392 Apr 28 03:24 python3.9-gdb.py
lrwxrwxrwx 1 user user 16 Apr 28 03:24 python3-config -> python3.9-config
lrwxrwxrwx 1 user user 16 Apr 28 03:24 python-config -> python3.9-config
보시다시피 이것은 을 python3
가리키는 심볼릭 링크입니다 /etc/alternatives/python3
. 아래 스크린샷은 상황을 보여줍니다./etc/alternatives/python3
┌──(user㉿kali)-[/etc/alternatives/python3]
└─$ ls -al
total 116
drwxrwxrwx 2 user user 4096 Apr 28 07:10 .
drwxrwxrwx 6 user user 4096 Apr 28 03:24 ..
lrwxrwxrwx 1 user user 8 Apr 28 03:24 2to3 -> 2to3-3.9
-rwxrwxrwx 1 user user 127 Apr 28 03:24 2to3-3.9
lrwxrwxrwx 1 user user 7 Apr 28 03:24 idle -> idle3.9
lrwxrwxrwx 1 user user 7 Apr 28 03:24 idle3 -> idle3.9
-rwxrwxrwx 1 user user 125 Apr 28 03:24 idle3.9
lrwxrwxrwx 1 user user 6 Apr 28 03:24 pip -> pip3.9
-rwxrwxrwx 1 user user 255 Apr 28 03:24 pip3
-rwxrwxrwx 1 user user 255 Apr 28 03:24 pip3.9
lrwxrwxrwx 1 user user 8 Apr 28 03:24 pydoc -> pydoc3.9
lrwxrwxrwx 1 user user 8 Apr 28 03:24 pydoc3 -> pydoc3.9
-rwxrwxrwx 1 user user 110 Apr 28 03:24 pydoc3.9
lrwxrwxrwx 1 user user 9 Apr 28 03:24 python -> python3.9
lrwxrwxrwx 1 root root 25 Mar 13 08:18 python3 -> /etc/alternatives/python3
-rwxrwxrwx 1 user user 17576 Apr 28 03:23 python3.9
-rwxrwxrwx 1 user user 3111 Apr 28 03:24 python3.9-config
-rwxrwxrwx 1 user user 65392 Apr 28 03:24 python3.9-gdb.py
lrwxrwxrwx 1 user user 16 Apr 28 03:24 python3-config -> python3.9-config
lrwxrwxrwx 1 user user 16 Apr 28 03:24 python-config -> python3.9-config