вторник, 31 декабря 2019 г.

No module name '_ctypes' while creating new virtualenv

When I tried to create virtualenv with python3.7 (
virtualenv -p /usr/local/bin/python3.7
on one of my fresh VPS I faced
no module name '_ctypes'
You should perform these steps to fix it:
sudo apt-get update
sudo apt-get install libffi-dev
If you still have same error then you probably installed python3.7 by yourself from source codes. If so just repeat this installation:
cd /usr/src
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
sudo tar xzf Python-3.7.4.tgz
cd Python-3.7.4
sudo ./configure --enable-optimizations
sudo make altinstall
:hint if you have more than one cpu core, then you can speed up make stage by:
sudo make altinstall -j <number_of_cores>
:hint
cat /proc/cpuinfo
- shows you the information about your CPUs

среда, 18 декабря 2019 г.

postgresql - permission denied for sequence

Если ты столкнулся с %%permission denied for sequence %%, то значит, что ты используешь в табличке автоинкремент ( тип %%SERIAL%% или %%BIGSERIAL%% ) и тебе нужны соответствующие гранты соответствуюшему пользователю: %%grant all privileges on sequence to %%

postgresql - permission denied for relation

Если ты столкнулся с %%permission denied for relation%% , то попробуй дать соответствующему юзеру: %%grant all privileges on table to ;%%

среда, 4 декабря 2019 г.

python3 f-string 'invalid syntax'

If you faced 'invalid syntax' while using f-strings in python3 then you probably have ancient python version installed. f-strings feature appeared in 3.6 So you have to install a new python to be able to use f-strings in your code: For example, you are in Ubuntu ( or some other deb-based distrib ):
sudo wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz sudo tar xzf Python-3.7.4.tgz cd Python-3.7.4 sudo ./configure --enable-optimizations sudo make altinstall # not to replace default python