py2exe including MSVC DLLs in the .exe

When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll

The former can be included in the .exe using this tip. However, the latter is just placed in the dist dir by py2exe and not into the executable, even if I specifically ask to include it.

Any idea how to cause py2exe to include both inside the .exe ?


Asked by: Roland637 | Posted: 05-10-2021






Answer 1

Wouldn't it fail to launch, then? You want msvcr71.dll in the same directory as the exe, so that the library loader will be able to find and link it into the application's memory map.

It's needed for basic operation, so you can't just let py2exe unpack it with the rest of the DLLs.

Answered by: Blake664 | Posted: 06-11-2021



Answer 2

py2exe can't do this. You can wrap py2exe (there is an example on the wiki showing how to do that with NSIS); you could build your own wrapper if using NSIS or InnoSetup wasn't an option.

Alternatively, if you're positive that your users will have a compatible copy of msvcr71.dll installed (IIRC Vista or XP SP2 users), then you could get away without including it. More usefully, perhaps, if you use Python 2.3 (or older), then Python links against msvcr.dll rather than msvcr71.dll, and any Windows user will have that installed, so you can just not worry about it.

Answered by: Haris751 | Posted: 06-11-2021



Answer 3

Yes, py2exe can do this. View this link.And if you are using python2.7, replace "msvcr71" to "msvcp90".

Answered by: Maddie151 | Posted: 06-11-2021



Similar questions

python - Including a Django app's url.py is resulting in a 404

I have the following code in the urls.py in mysite project. /mysite/urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^gallery/$', include('mysite.gallery.urls')), ) This results in a 404 page when I try to access a url set in gallery/urls.py. /mysite/gallery/urls.py from django.conf.urls.defa...


python - Including If In Arrays Formed Using For

In Python I have this statement: blog_ids = [c.blog_id for c in connections] Which basically tells Python to create an array of all the blog IDs in the connections. Unfortunately, if the connections object has some None types, c.blog_id would cause an exception. Is there any syntax to solve this problem? I tried this but it doesn't work:


python - Including part of html file in web2py

I am a newbie to web2py and want to do this.. I am doing a presentation web application , in which users can view presentations(reveal.js files) of a number of topics. These presentations contain head tags and scripts which are same to all.. so i thought of creating a view called default/presentation.html and then store all the presentations as html/xml files and display them inside t...


python - Why is peewee including the 'id' column into the mysql select query?

I am trying to learn how to use peewee with mysql. I have an existing database on a mysql server with an existing table. The table is currently empty (I am just testing right now). >>> db = MySQLDatabase('nhl', user='root', passwd='blahblah') >>> db.connect() >>> class schedule(Model): ... date = DateField() ... team = CharField() ... class Meta: ... ...


Python XML sax parser drops everything including &

First time poster. I'll try to be as specific as possible. To narrow questions down, I have no control over what the xml document looks like (I have to make the parser work with the document as is). The file is well formed (there's nothing telling me the document is not well formed and I see no reason as to why it wouldn't be). I'm not getting any errors back from the program (or exceptions from the parser). Anyway... ...


python - Linear fit with log plot including errors on the y axis

I was following this discussion: Polynomial fitting with log log plot to linearly fit data on a log axis. However, I still can not understand how to include the errors (in my case, on the y data) in the fit and in the plot. Any suggestion please? EDIT: the log axis is only the x axis


python - Equal bin sizes including border using mayavi imshow?

I am doing a very simple task of plotting a 2d numpy histogram and displaying with with mayavi.mlab.imshow(my2dhistogram, interpolate=False) For a 5x5 array the output is the following, I would like the bins along the border to be the same size as the ones in the center. I understand the logic of...


python - Timing a unit test, including the set up

How can you capture the time of an individual unit-test, including the set-up cost? I've got a test base with a set-up procedure which takes a non-trivial amount of time to complete. I've got several tests which descend from that test base, and I've got a decorator which, in theory, should print out the time it takes to run each test: class TestBase(unittest.TestCase): def setUp(self): #...


python - Use Regex re.sub to remove everything before and including a specified word

I've got a string, which looks like "Blah blah blah, Updated: Aug. 23, 2012", from which I want to use Regex to extract just the date Aug. 23, 2012. I found an article in the stacks which has something similar: regex to remove all text before a character, but that's not working either when I tried


python - Not including space in regex

I have the following string where I want CL3 and everything the proceeds it. String: "1600m Dead CL3 $4,500" What I want: CL3 $4,500 This is my current regex: [^(Dead|Good|Heavy|Slow|Fast)]+$ At the moment Python returns an empty string and in an online regex engine:


python - Including a dynamic image in a web page using POST?

I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code: <img src="image.py?text=xxxxxxxxxxxxxx"> The problem is that I expect in the future the "text" field will get very long and the URL will become too large. From Googling around there doesn't seem to be a fixed limit on URL length (ie. depend...


python - Write variable to file, including name

Let's say I have the following dictionary in a small application. dict = {'one': 1, 'two': 2} What if I would like to write the exact code line, with the dict name and all, to a file. Is there a function in python that let me do it? Or do I have to convert it to a string first? Not a problem to convert it, but maybe there is an easier way. I do not need a way to convert it to a st...


What program to write pdf including other pdf on Linux from Python?

On an Ubuntu server, I want to create pdfs which include other static pdfs. I have tried using ReportLab with pyPdf. Ideally I would use ReportLab to do the whole thing, but in order to import the pdfs requires their PageCatcher which has a large recurring fee. So I use pyPdf to merge a page created with ReportLab and my other pdfs. The problem is that even though this looks fine in Acrobat and Foxit, part of one ...


python - Including a pyd directly in a setup.py file

I have a complex build process to generate a couple of python extension modules (.pyd). I want to include these in my setup.py for use with distutils. The distutils page talks in length about how to add extension modules from source, but I'd want to simply package these precompiled .pyd. What is the best practice to do this? Eventually, I'd also like to freeze everything in an executable with py2exe. Will I be able...


python - Including libraries in project. Best practice

I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this information into a README file informing the use about the other required libraries. I've p...


Python datetime not including DST when using pytz timezone

If I convert a UTC datetime to swedish format, summertime is included (CEST). However, while creating a datetime with sweden as the timezone, it gets CET instead of CEST. Why is this? >>> # Modified for readability >>> import pytz >>> import datetime >>> sweden = pytz.timezone('Europe/Stockholm') >>> >>> datetime.datetime(2010, 4, 20, 16, 20, tzinfo=pytz...


python - filter queryset based on list, including None

I dont know if its a django bug or a feature but i have a strange ORM behaviour with MySQL. class Status(models.Model): name = models.CharField(max_length = 50) class Article(models.Model) status = models.ForeignKey(status, blank = True, null=True) filters = Q(status__in =[0, 1,2] ) | Q(status=None) items = Article.objects.filter(filters) this returns Article items but some ha...


python - Including a Django app's url.py is resulting in a 404

I have the following code in the urls.py in mysite project. /mysite/urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^gallery/$', include('mysite.gallery.urls')), ) This results in a 404 page when I try to access a url set in gallery/urls.py. /mysite/gallery/urls.py from django.conf.urls.defa...


python - Failure loading py2exe'd program when including pysvn

I am attempting to run a py2exe'd program (package.py) that includes pysvn. It is failing to run with the following error: Traceback (most recent call last): File "package.py", line 27, in <module> File "zipextimporter.pyc", line 82, in load_module File "pysvn\__init__.pyc", line 99, in <module> File "zipextimporter.pyc", line 98, in load_module ImportError: MemoryLoadLibra...


python - Including Flash content inline in a custom Weblog?

I'm trying to think of a way to place Flash content into a blog post so that it appears inline between paragraphs. I'm writing a custom weblog application in Django (still learning) and I'll be using SWFObject for the embedding. The blog is for me only so the back-end isn't too fancy. I'm simply using Django's built in admin interface. No ...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top