web123456

MacOs M1 installation python environment (pyenv+virtualenv) summary

# macosInstalled in the middle
brew install pyenv
brew install pyenv-virtualenv

#The python version does not take effect after pyenv activated because pyenv virtualenv is createdVirtual environmentIt is not activated when it is done, so it needs to activate virtulanev before creating it.
In macos
ivan@ivandeMacBook-Pro ~ % source ~/.zshrc
ivan@ivandeMacBook-Pro ~ % cat .zshrc
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

In macos
ivan@ivandeMacBook-Pro ~ % cat .zprofile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

# Summary of issues in installing python running environment using pyenv virtualenv
1. No module named '_ctypes'
Install the following package
brew install libffi

MacOs M1 Direct Installationpython3.9In the above version, libffi installation will still report an error if it is installed on libffi.

2. Mysqlclient installation failed, prompting what mysql_config cannot be found
Follow /shen-qiang/p/ step by step

ps:
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"  # This place is changed to exactly the same. It turns out that there will be some more parameters, just remove them directly, otherwise you will encounter this problem macos ld:library not found for -lcrypto

3. Psycopg2 installation
To install postgresql first, the installation link: /postgresql-tutorial-resources-training?cid=47

Otherwise, the error will be reported. pg_config cannot be found.

If useddjango
/postgres-tutorials/how-use-postgresql-django
Follow this