Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dot not get expected result when running ReadMe example #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mushramb0 opened this issue Jun 11, 2018 · 3 comments
Closed

dot not get expected result when running ReadMe example #684

mushramb0 opened this issue Jun 11, 2018 · 3 comments

Comments

@mushramb0
Copy link

mushramb0 commented Jun 11, 2018

Environment

Pythonnet version: 2.3
Python version: 3.5.5
Operating System: Windows 10

Details

hi,my code is:
static void Main(string[] args)
{
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 });
    Console.WriteLine(b.dtype);

    Console.WriteLine(a * b);
    Console.ReadKey();
}

}

my output is:
1.0
-0.9589242746631385
-0.675262089199912
object
object
NULL

why not the same as the readme output?

@den-run-ai
Copy link
Contributor

@mushramb0 please use the master branch and see this linked issue:

#563

@mushramb0
Copy link
Author

@denfromufa thank you for answer.but when i run command "python setup.py bdist_wheel",throw exception:
Running bdist_wheel
Running build
Running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
NuGet.exe 4.6.2 is currently running.
NuGet.exe is the latest.
MSBuild auto-detection: using msbuild version '15.7.179.6572' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'.
All the packages listed in packages.config are already installed.
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.
Microsoft(R) Build Engine Version 4.7.2556.0
[Microsoft .NET Framework Version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. all rights reserved.

Microsoft(R) Build Engine Version 4.7.2556.0
[Microsoft .NET Framework Version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. all rights reserved.

CSC : error CS1617: Option '6' is invalid for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default [C:\Users\Administrator\Desktop\pythonnet-2.
3.0\src\runtime\Python.Runtime.csproj]
CSC : error CS1617: Option '6' is invalid for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default [C:\Users\Administrator\Desktop\pythonnet-2.
3.0\src\clrmodule\clrmodule.csproj]
Traceback (most recent call last):
  File "setup.py", line 405, in
    Zip_safe=False,
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools_init_.py", line 129, in setup
    Return distutils.core.setup(**attrs)
  File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
    Dist.run_commands()
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
    Self.run_command(cmd)
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    Cmd_obj.run()
  File "C:\ProgramData\Anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
    Self.run_command('build')
  File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
    Self.distribution.run_command(command)
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    Cmd_obj.run()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
    Self.run_command(cmd_name)
  File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
    Self.distribution.run_command(command)
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    Cmd_obj.run()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 339, in run
    Self.build_extensions()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 448, in build_extensions
    Self._build_extensions_serial()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
    Self.build_extension(ext)
  File "setup.py", line 222, in build_extension
    Subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 291, in check_call
    Raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" pythonnet.sln /p:Configuration=ReleaseWin /p:Platform=x64 /p:DefineConstants="PYTHON36,PYTHON3 , UCS2" /p:PythonBuildDir="C:\Users\Administrator\Desktop\pythonnet-2.3.0\build\lib.win-amd64-3.6" /p:PythonInteropFile="interop36.cs" /verbosity:minimal /p :PythonManifest="C:\Users\Administrator\Desktop\pythonnet-2.3.0\build\lib.win-amd64-3.6\app.manifest" /t:Build' returned non-zero exit status 1.

@den-run-ai
Copy link
Contributor

You can grab the wheels from appveyor artifacts for master branch.

Your "error CS1617" is due to some mismatch between build tools. Try updating vswhere.exe to latest version:

#539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants