How to install Psycopg2 for Python 3.5

I am trying to execute the following command on Windows 7 using powershell

pip install psycopg2 

And I get the error message:

Error: Microsoft Visual C ++ 14.0 required (cannot find vcvarsall.bat). The command "C: \ Users \ Piyush \ AppData \ Local \ Programs \ Python \ Python35 \ python.exe -c" imports setuptools, tokenize; file = 'C: \ Users \ Piyush \ AppData \ Local \ Temp \ pip-build-qe38dwoj \ psycopg2 \ setup.py'; exec (compilation (getattr (tokenize, 'open', open) ( file ). Read (). Replace ('\ r \ n', '\ n'), file , 'exec')) "install -record C: \ Users \ Piyush \ AppData \ Local \ Temp \ pip-7bjug79j-record \ install- record.txt --single-version-external-managed -compile "failed with error code 1 in C: \ Users \ Piyush \ AppData \ Local \ Temp \ pip-build-qe38dwoj \ psycopg2

To install Intu Visuall C ++, you need to install Visual Studio. Except for installing Visual Studio 2013. Are there any others that I can install Psycopg2 for Python 3.5 ??

+5
source share
3 answers

I ran into a similar problem on Windows. I had to install the compiled version and then easy_install it.

You can find the compiled version of psycopg2 here: http://www.lfd.uci.edu/~gohlke/pythonlibs/

And then do easy_install C: /locaiton/of/download.exe

What am I doing to install it on my windows machine.

+8
source

Try it. It worked for me

I visited http://www.lfd.uci.edu/~gohlke/pythonlibs/ and downloaded psycopg2-2.6.1-cp35- none-win32.whl and copied it to C: \

I later activated my Virualenv by running this C: \ mydjango \ django19 \ Scripts \ activ on cmd, which led to this (django19) C: / "> and executed the following pip command, pip install psycopg2-2.6.1-cp35-none -win32.whl , and the installation was successful.

Note. Run pip install psycopg2 ....... whl when you are in the current folder with the file psycopg2-2.6.1-cp35-none-win32.whl via cmd

+11
source

For Linux / Mac, you must first install:

 sudo apt-get install python3-dev 

and then install psycopg2:

 pip install psycopg2 

For me, this worked on a server manufactured by DigitalOcean Linux 16.04

Let me know if someone got it right!

+1
source

Source: https://habr.com/ru/post/1213742/


All Articles