Environment :
I am running this example from Pythonnet wiki.
using (Py.GIL())
{
dynamic np = Py.Import("numpy");
Console.WriteLine(np.cos(np.pi * 2));
dynamic sin = np.sin;
Console.WriteLine(sin(5));
double c = np.cos(5) + sin(5);
Console.WriteLine(c);
dynamic a = np.array(new List<float> { 1, 2, 3 });
Console.WriteLine(a.dtype);
dynamic b = np.array(new List<float> { 6, 5, 4 }, dtype: np.int32);
Console.WriteLine(b.dtype);
Console.WriteLine(a * b);
Console.ReadKey();
}
result
1.0
-0.9589242746631385
-0.675262089199912
object
error occurs here :
dynamic b = np.array(new List { 6, 5, 4 }, dtype: np.int32);
error message :
Python.Runtime.PythonException: 'TypeError : int() argument must be a string, a bytes-like object or a number, not '0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]''
stack trace :
Python.Runtime.PythonException
HResult=0x80131500
Message=TypeError : int() argument must be a string, a bytes-like object or a number, not '0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'
Source=Python.Runtime
StackTrace:
Tried Solution but no success :
1) https://github.com/pythonnet/pythonnet/issues/249
2) download zip file from master and run from Amaconda prompt
python setup.py bdist_wheel --xplat
pip install dist\pythonnet-2.4.0.dev0-cp36-cp36m-win64.whl
python setup.py bdist_wheel
failed because need import error : mt.exe could not be found
I did not restart my pc while installing Visual Studio 2017 Community.
So, i think that Visual Studio 2017 Installer did not install mt.exe for me.
Restart PC is not an option for me.
===
Would Like to know is there any option to solve this issue, Thank You.
According to the developer of Pythonnet, i had tried to install the master of pythonnet.
After the installation completed, i run ReadMe successfully.
User contributions licensed under CC BY-SA 3.0