compiling for .NET CLR4, Python 2.7
![](https://secure.gravatar.com/avatar/70186193dab27a406c53d2cb24355bc6.jpg?s=120&d=mm&r=g)
Hello, I'm new to .NET and just trying to make available a few .NET dll files for an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC. I have managed to get the latest svn version, confirmed required changes according to: http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/ were made. Though, it seemed most were no longer necessary in the latest SVN version. I also changed the Conditional Compilation symbols to: PYTHON27,UCS2 under the Python.Runtime, Properties->Build tab. I rebuilt the entire solution, and all compiled with no errors. However, I get the following when I try to run Python.exe: PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> .\python.exe ImportError: No module named site PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> Does anyone have experience building pythonnet for Python 2.7 and .NET 4? Thank you in advance, john
![](https://secure.gravatar.com/avatar/c04e149a2844e49505f0a410cf21cc24.jpg?s=120&d=mm&r=g)
I also tried to build on a 64bit Windows 7 machine and was not able to make it work consistently. I was told that the issue was with the version of VS that I used to build PythonNet. I am not knowledgeable in this area however, and could not figure out how to get it to work consistently. I was trying to use it with a distribution of CPython 2.6 (which caused me the most trouble) and CPython 2.7. I stopped working on it as I could only get 2.7 to see the PythonNet module. I'm curious what answers you come up with as I would still love to get this to work on my machine. Thomas On Tue, Oct 30, 2012 at 7:19 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Hello,
I'm new to .NET and just trying to make available a few .NET dll files for an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC.
I have managed to get the latest svn version, confirmed required changes according to: http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/
were made. Though, it seemed most were no longer necessary in the latest SVN version.
I also changed the Conditional Compilation symbols to: PYTHON27,UCS2 under the Python.Runtime, Properties->Build tab.
I rebuilt the entire solution, and all compiled with no errors.
However, I get the following when I try to run Python.exe:
PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> .\python.exe ImportError: No module named site PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug>
Does anyone have experience building pythonnet for Python 2.7 and .NET 4?
Thank you in advance, john
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
![](https://secure.gravatar.com/avatar/70186193dab27a406c53d2cb24355bc6.jpg?s=120&d=mm&r=g)
Interesting finding... I just uninstalled EPD (Enthought Python Distribution) and installed vanilla Python 2.7 So far it seems all is working. On Tue, Oct 30, 2012 at 9:39 PM, Thomas Stanley-Jones < tstanleyjones@gmail.com> wrote:
I also tried to build on a 64bit Windows 7 machine and was not able to make it work consistently. I was told that the issue was with the version of VS that I used to build PythonNet. I am not knowledgeable in this area however, and could not figure out how to get it to work consistently. I was trying to use it with a distribution of CPython 2.6 (which caused me the most trouble) and CPython 2.7. I stopped working on it as I could only get 2.7 to see the PythonNet module. I'm curious what answers you come up with as I would still love to get this to work on my machine.
Thomas
On Tue, Oct 30, 2012 at 7:19 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Hello,
I'm new to .NET and just trying to make available a few .NET dll files for an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC.
I have managed to get the latest svn version, confirmed required changes according to: http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/
were made. Though, it seemed most were no longer necessary in the latest SVN version.
I also changed the Conditional Compilation symbols to: PYTHON27,UCS2 under the Python.Runtime, Properties->Build tab.
I rebuilt the entire solution, and all compiled with no errors.
However, I get the following when I try to run Python.exe:
PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> .\python.exe ImportError: No module named site PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug>
Does anyone have experience building pythonnet for Python 2.7 and .NET 4?
Thank you in advance, john
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
![](https://secure.gravatar.com/avatar/70186193dab27a406c53d2cb24355bc6.jpg?s=120&d=mm&r=g)
Hello, I have a request into Enthought for some insight on why I would get an "ImportError" for the site module. They've asked that I pose a question to the pythonnet group, and whether anyone knows what custom PATH variables the pythonnet python.exe may be searching? Thank you, john On Thu, Nov 1, 2012 at 9:54 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Interesting finding...
I just uninstalled EPD (Enthought Python Distribution) and installed vanilla Python 2.7
So far it seems all is working.
On Tue, Oct 30, 2012 at 9:39 PM, Thomas Stanley-Jones < tstanleyjones@gmail.com> wrote:
I also tried to build on a 64bit Windows 7 machine and was not able to make it work consistently. I was told that the issue was with the version of VS that I used to build PythonNet. I am not knowledgeable in this area however, and could not figure out how to get it to work consistently. I was trying to use it with a distribution of CPython 2.6 (which caused me the most trouble) and CPython 2.7. I stopped working on it as I could only get 2.7 to see the PythonNet module. I'm curious what answers you come up with as I would still love to get this to work on my machine.
Thomas
On Tue, Oct 30, 2012 at 7:19 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Hello,
I'm new to .NET and just trying to make available a few .NET dll files for an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC.
I have managed to get the latest svn version, confirmed required changes according to: http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/
were made. Though, it seemed most were no longer necessary in the latest SVN version.
I also changed the Conditional Compilation symbols to: PYTHON27,UCS2 under the Python.Runtime, Properties->Build tab.
I rebuilt the entire solution, and all compiled with no errors.
However, I get the following when I try to run Python.exe:
PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> .\python.exe ImportError: No module named site PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug>
Does anyone have experience building pythonnet for Python 2.7 and .NET 4?
Thank you in advance, john
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
![](https://secure.gravatar.com/avatar/70186193dab27a406c53d2cb24355bc6.jpg?s=120&d=mm&r=g)
Hello, Final update on this thread. For those interested. I managed to build the svn repo with Visual Studio 2012 and run it under EPD Python. My problems before were simply related to the PYTHONPATH settings under system propoerties and a required reboot to get those settings to register (welcome to windows?). My PYTHONPATH is now: C:\Python27\Libs; C:\Python27\Libs\site-packages I can run the pythonnet python.exe and import python modules such as os, sys, and datetime. I changed all the build environment settings to target .NET 4. as described in my initial post. --john On Fri, Nov 2, 2012 at 9:30 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Hello,
I have a request into Enthought for some insight on why I would get an "ImportError" for the site module.
They've asked that I pose a question to the pythonnet group, and whether anyone knows what custom PATH variables the pythonnet python.exe may be searching?
Thank you, john
On Thu, Nov 1, 2012 at 9:54 AM, John Burkhart <jfburkhart.reg@gmail.com>wrote:
Interesting finding...
I just uninstalled EPD (Enthought Python Distribution) and installed vanilla Python 2.7
So far it seems all is working.
On Tue, Oct 30, 2012 at 9:39 PM, Thomas Stanley-Jones < tstanleyjones@gmail.com> wrote:
I also tried to build on a 64bit Windows 7 machine and was not able to make it work consistently. I was told that the issue was with the version of VS that I used to build PythonNet. I am not knowledgeable in this area however, and could not figure out how to get it to work consistently. I was trying to use it with a distribution of CPython 2.6 (which caused me the most trouble) and CPython 2.7. I stopped working on it as I could only get 2.7 to see the PythonNet module. I'm curious what answers you come up with as I would still love to get this to work on my machine.
Thomas
On Tue, Oct 30, 2012 at 7:19 AM, John Burkhart <jfburkhart.reg@gmail.com
wrote:
Hello,
I'm new to .NET and just trying to make available a few .NET dll files for an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC.
I have managed to get the latest svn version, confirmed required changes according to: http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/
were made. Though, it seemed most were no longer necessary in the latest SVN version.
I also changed the Conditional Compilation symbols to: PYTHON27,UCS2 under the Python.Runtime, Properties->Build tab.
I rebuilt the entire solution, and all compiled with no errors.
However, I get the following when I try to run Python.exe:
PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug> .\python.exe ImportError: No module named site PS G:\svn\Python\pythonnet\trunk\pythonnet\src\console\bin\Debug>
Does anyone have experience building pythonnet for Python 2.7 and .NET 4?
Thank you in advance, john
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
![](https://secure.gravatar.com/avatar/d808d9fa42f84addf192912f0ac645ff.jpg?s=120&d=mm&r=g)
On 30.10.2012 14:19, John Burkhart wrote:> Hello,
I'm new to .NET and just trying to make available a few .NET dll
files for
an application I would *like* to build in CPython. I'm trying to use pythonnet for the task as I would prefer not to use IronPython. I have Python 2.7 installed on a 64bit Windows 7 PC.
Are you using VS2008? If not try. Niki
participants (3)
-
John Burkhart
-
niki
-
Thomas Stanley-Jones