Heroku Tutorial with PIP, virtualenv, psycopg2, Django on Windows 7

Recently, I have been reading a lot about Geroku, and I am thinking about moving to him. I thought I would try to participate a bit and play a little with him.

Ok Confession Time. As long as I have installed virtualenv, I really don't use it. I am not a guy who very often switches between different projects (for example, as a contractor, which I need to do). I really like the idea of ​​this, but it is not. I know that everyone says these are the best practices these days.

The problem that I have is that I cannot get pip to install psycopg2 (which is part of the tutorial). Btw, here is a link to what I'm trying to do ( article to the hero )

So for me this is not a new problem. I could never get this thing to install via pip. I always run into a problem

Could not find vcvarsall.bat

The way I solved this in the past on a Windows machine was to simply load the prebuild libraries. If someone is interested and doesn't know, you can find it here ! By the way, thanks, Christoph Golke for supporting these !!!!

If you are looking for this vcvarsall.bat error, you will find several posts for it in Stackoverflow. None of them helped me. At first I tried to go the MingGW route. After literally 2 nights of effort (and I think I tried every suggestion I could find), I gave up (right before I threw my computer out of the window and continued to defeat the kitten). So, I tried another route that people offer - which should download the version of VC ++ 2008 Express from Microsoft. Python seems to be built for Windows with VC ++ 2008, and for some people this is much simpler than using MinGW. This seems to have worked a lot better for me, because I can at least get pip to install it. But when I try to import, I get another common problem that people seem to have a problem with (at least you get hits when you do this).

File "C: \ foo \ bar \ venv \ lib \ site-packages \ psycopg2__init __.py", line 67, from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: Error loading DLL: operating system not can run% 1.

After some research, it seems like this is a problem with the compiled _psycopg.pyd file trying to set the link in libpq.dll. This file is located in C: \ Program Files (x86) \ PostgreSQL \ 9.1 \ bin \ - and this is in my way.

So does anyone know how to fix this? Or is there a way to get pip to use pyscopg2, which has already been successfully installed (via pre-created libraries) in my sites? Note. I can fix the problem if I simply copy the pre-prepared psycopg2 package to the virtual environment site packages. he will import the fine. However, when you hang with beer for the requirements of the hero, it is not there. Is there any way to fake a hero on this?

Environment: Windows 7 (64 bit), Python 2.6.5, Django 1.3.1, virtualenv 1.6.4, PostgreSQL 9.1, pip 1.0.2

+4
source share
4 answers

I had the same set of impressions.

I noticed that when I try to manage.py runserver in the old application, it does not work in virtualenv. When I run python.exe manage.py runserver , it works in virtualenv.

Unfortunately, the trick does not seem to work on django-admin.py. I get an error: python.exe: can't open file 'django-admin.py' [Errno 2] No such file or directory

But when I run the python interpreter and import django, it works fine.

Not sure if this helps, but thought it was worth it.

+2
source

I had the exact same problem as yours and tried to fix the problem.

After using Visual Basic 2008 to resolve the "Cannot find vcvarsall.bat" error

I installed PostgreSQL (there is no need to download anything from StackBuilder), and Heroku finally let me deploy the Django application without any problems. Installing PostgreSQL was a prerequisite for deploying your Django application (and it is usually not visible, but it is at the top of the same page)!

Hope this helps future users solve any such problems you might have.

+1
source

I ran into all the problems that you have been stating so far, and I try to keep a journal of which hoops I need to skip to write a blog post later. I think the last error you see can be resolved by simply adding a Windows path environment variable to the Postgres bin directory.

0
source

Make sure that:

Your distutils.cfg points to mingw
You have 32-bit PostgreSQL installed if you get ld errors on libpq.dll

0
source

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


All Articles