[frida] error: externally-managed-environment

$ python3 -m pip install requests # or any other module

error: externally-managed-environment

× This environment is externally managed

╰─> To install Python packages system-wide, try brew install

xyz, where xyz is the package you are trying to

install.

If you wish to install a non-brew-packaged Python package,

create a virtual environment using python3 -m venv path/to/venv.

Then use path/to/venv/bin/python and path/to/venv/bin/pip.

If you wish to install a non-brew packaged Python application,

it may be easiest to use pipx install xyz, which will manage a

virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

 

 

Frida를 사용하려고 하니 이런 오류가 떴다.

 

 

내 컴퓨터에서는 왠지 모르겠지만 무슨 옵션을 계속 바꿔봐도 오류가 계속 뜨길래 ㄱ-

 

 

https://discuss.python.org/t/on-macos-14-pip-install-throws-error-externally-managed-environment/50352/6

 

On MacOS 14, pip install throws error: externally-managed-environment

Homebrew wants you to create a virtual env so that pip-installed modules don’t break something in your system. Same is true if working with python installed by apt-get in Ubuntu for same reason. The package makers have gone to warning us not to pip insta

discuss.python.org

 

 

이 글을 참고하여 해결했다.

 

아마 docker처럼 가상 환경을 임의로 만들어서 거기서 frida를 동작하도록 사용하는 것 같다.

 

 

mkdir ~/.venv

python3 -m venv ~/.venv

#	Creates the following in ~/.venv
#		bin/
#		include/
#		lib/
#		pyvenv.cfg
		
#		does not create pip-selfcheck.json 

# to activate the venv
source ~/.venv/bin/activate

# now you can..
python3 -m pip install <module name>

# and it will install the module in the virtual env

# to deactivate the venv
deactivate # or exit the shell

# you should see the folder name for the venv below your prompt when active, like so
pstivers3@mbp ~/repos/learn/pythonlearn
$ 
(.venv) 

# Note, you can chose any folder location and name that you want for the venv. ~/.venv is typical.
# Your project code can be in any directory.

 

 

위 코드대로 따라하면 정상적으로 실행된다!