Description
I have the following settings:
- Pythonnet version: 2.3.0, installed with pip in Amaconda3
- Python version: 3.6.6 using with Anaconda 3
- Visual Studio 2017 Community
- Operating System: Windows 7, 64 bit
I run this code, and it pops out this error.
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);"
I get the following error:
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 still have not solve :
-
referred TypeError when running ReadMe example #554
download zip file 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.
while running on Visual Studio 2017 that fully installed, i found this issue in python setup.py bdist_wheel --xplat
delegatemanager.cs(204,13): warning CS0162: Unreachable code detected [C:\Users
\JamesTan\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.1
5.csproj]
pythonexception.cs(67,13): warning CS0162: Unreachable code detected [C:\Users\
JamesTan\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15
.csproj]
pyobject.cs(51,13): warning CS0162: Unreachable code detected [C:\Users\JamesTa
n\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15.csproj]
pyscope.cs(534,13): warning CS0162: Unreachable code detected [C:\Users\JamesTa
n\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15.csproj]
delegatemanager.cs(204,13): warning CS0162: Unreachable code detected [C:\Users
\JamesTan\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.1
5.csproj]
pyobject.cs(51,13): warning CS0162: Unreachable code detected [C:\Users\JamesTa
n\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15.csproj]
pyscope.cs(534,13): warning CS0162: Unreachable code detected [C:\Users\JamesTa
n\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15.csproj]
pythonexception.cs(67,13): warning CS0162: Unreachable code detected [C:\Users\
JamesTan\Desktop\pythonnetmaster\pythonnet-master\src\runtime\Python.Runtime.15
.csproj]
dynamic.cs(121,28): warning CS0618: 'PythonEngine.RunString(string, IntPtr?, In
tPtr?)' is obsolete: 'RunString is deprecated and will be removed. Use Exec/Eva
l/RunSimpleString instead.' [C:\Users\JamesTan\Desktop\pythonnetmaster\pythonne
t-master\src\embed_tests\Python.EmbeddingTest.15.csproj]
dynamic.cs(121,28): warning CS0618: 'PythonEngine.RunString(string, IntPtr?, In
tPtr?)' is obsolete: 'RunString is deprecated and will be removed. Use Exec/Eva
l/RunSimpleString instead.' [C:\Users\JamesTan\Desktop\pythonnetmaster\pythonne
t-master\src\embed_tests\Python.EmbeddingTest.15.csproj]
C:\Users\JamesTan\.nuget\packages\unmanagedexports\1.2.7\tools\RGiesecke.DllExp
ort.targets(58,3): error : Microsoft.Build.Utilities.ToolLocationHelper could n
ot find ildasm.exe. [C:\Users\JamesTan\Desktop\pythonnetmaster\pythonnet-master
\src\clrmodule\clrmodule.15.csproj]
Run pip install dist\pythonnet-2.4.0.dev0-cp36-cp36m-win64.whl
this error occurs
Requirement 'dist\\pythonnet-2.4.0.dev0-cp36-cp36m-win64.whl' looks like a filen
ame, but the file does not exist
pythonnet-2.4.0.dev0-cp36-cp36m-win64.whl is not a supported wheel on this platf
orm.
===
Would like to ask that, is there any option to solve this ? Thank you,