在 Ubuntu 18.04 上安装 pythonnet,Python 3.6.7 64 位,Mono 5.16 失败 [英] Install pythonnet on Ubuntu 18.04, Python 3.6.7 64-bit, Mono 5.16 fails

查看:117
本文介绍了在 Ubuntu 18.04 上安装 pythonnet,Python 3.6.7 64 位,Mono 5.16 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Ubuntu 上安装 pythonnet,但安装失败.

I would like to install pythonnet on Ubuntu, but it fails.

这就是我到目前为止所尝试的:

That's what I tried so far:

/usr/bin/python3 -m pip install -U pythonnet --user

错误:

Collection pythonnet
  Using cached https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Building wheels for collected packages: pythonnet
  Running setup.py bdist_wheel for pythonnet ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sv3ax85u/pythonnet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp36arfp8upip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  Checking for updates from https://www.nuget.org/api/v2/.
  Currently running NuGet.exe 3.5.0.
  Updating NuGet.exe to 4.9.3.
  Update successful.
  MSBuild auto-detection: using msbuild version '15.0' from '/usr/lib/mono/msbuild/15.0/bin'.
  Restoring NuGet package NUnit.3.6.0.
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg 511ms
  Installing NUnit 3.6.0.
  WARNING: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg 131ms
  Installing NUnit 3.6.0.
  WARNING: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg 88ms
  Installing NUnit 3.6.0.
  WARNING: Unable to find version '3.6.0' of package 'NUnit'.
    /home/localadmin/.nuget/packages/: Package 'NUnit.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
    https://api.nuget.org/v3/index.json: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
    Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.

  Restoring NuGet package NUnit.ConsoleRunner.3.6.0.
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg 503ms
  Installing NUnit.ConsoleRunner 3.6.0.
  WARNING: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg 1098ms
  Installing NUnit.ConsoleRunner 3.6.0.
  WARNING: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg 103ms
  Installing NUnit.ConsoleRunner 3.6.0.
  WARNING: Unable to find version '3.6.0' of package 'NUnit.ConsoleRunner'.
    /home/localadmin/.nuget/packages/: Package 'NUnit.ConsoleRunner.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
    https://api.nuget.org/v3/index.json: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
    Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.

  Restoring NuGet package UnmanagedExports.1.2.7.
  WARNING: Unable to obtain lock file access on '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' for operations on 'packages/UnmanagedExports.1.2.7'. This may mean that a different user or administator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' will allow NuGet to continue.
  WARNING: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.
  WARNING: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.
  WARNING: Unable to find version '3.6.0' of package 'NUnit'.
    /home/localadmin/.nuget/packages/: Package 'NUnit.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
    https://api.nuget.org/v3/index.json: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
    Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.

  WARNING: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.
  WARNING: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
  Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.
  WARNING: Unable to find version '3.6.0' of package 'NUnit.ConsoleRunner'.
    /home/localadmin/.nuget/packages/: Package 'NUnit.ConsoleRunner.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
    https://api.nuget.org/v3/index.json: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
    Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.

  WARNING: Unable to obtain lock file access on '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' for operations on 'packages/UnmanagedExports.1.2.7'. This may mean that a different user or administator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' will allow NuGet to continue.

  Errors in packages.config projects
      Unable to find version '3.6.0' of package 'NUnit'.
        /home/localadmin/.nuget/packages/: Package 'NUnit.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
        https://api.nuget.org/v3/index.json: Error downloading 'NUnit.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg'.
        Access to the path "/home/localadmin/.nuget/packages/nunit/3.6.0" is denied.
      Unable to find version '3.6.0' of package 'NUnit.ConsoleRunner'.
        /home/localadmin/.nuget/packages/: Package 'NUnit.ConsoleRunner.3.6.0' is not found on source '/home/localadmin/.nuget/packages/'.
        https://api.nuget.org/v3/index.json: Error downloading 'NUnit.ConsoleRunner.3.6.0' from 'https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg'.
        Access to the path "/home/localadmin/.nuget/packages/nunit.consolerunner/3.6.0" is denied.
      Unable to obtain lock file access on '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' for operations on 'packages/UnmanagedExports.1.2.7'. This may mean that a different user or administator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file '/tmp/NuGetScratch/lock/db443dd345f7ac17ac9828f7824a62300ac88e2c' will allow NuGet to continue.

  NuGet Config files used:
      /home/localadmin/.config/NuGet/NuGet.Config

  Feeds used:
      /home/localadmin/.nuget/packages/
      https://api.nuget.org/v3/index.json
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-sv3ax85u/pythonnet/setup.py", line 405, in <module>
      zip_safe=False,
    File "/home/localadmin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.6/dist-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/tmp/pip-build-sv3ax85u/pythonnet/setup.py", line 139, in build_extension
      self._install_packages()
    File "/tmp/pip-build-sv3ax85u/pythonnet/setup.py", line 273, in _install_packages
      subprocess.check_call(cmd, shell=use_shell)
    File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'mono tools/nuget/nuget.exe restore pythonnet.sln -o packages' returned non-zero exit status 1.

  ----------------------------------------
  Failed building wheel for pythonnet

我也看了https://github.com/pythonnet/pythonnet/wiki/安装,但没有帮助.

I took a look as well at https://github.com/pythonnet/pythonnet/wiki/Installation but it didn't helped.

所以这也失败了:

/usr/bin/python3 -m pip install git+https://github.com/pythonnet/pythonnet --user

我也尝试过使用和不使用 --egg 选项.

I tried as well with and without the --egg option.

顺便说一下,我在代理服务器后面.所以我也尝试为 NuGet 设置代理服务器,请参阅 NuGet 背后的代理:

By the way I'm behind a proxy server. So I tried as well to set the proxy server for NuGet, see NuGet Behind Proxy:

mono /usr/lib/nuget/nuget.exe config -set http_proxy=http://my.proxy.address:port

知道我做错了什么吗?

推荐答案

我能够使用以下命令安装它:

I was able to install it with the following commands:

sudo apt update
sudo apt-get install clang
sudo apt-get install libglib2.0-dev
sudo apt install git
sudo apt install nuget
git config --global http.proxy http://my.proxy.address:port
mono /usr/lib/nuget/nuget.exe config -set http_proxy=http://my.proxy.address:port
/usr/bin/python3 -m pip install -U pycparser --user
/usr/bin/python3 -m pip install -U git+https://github.com/pythonnet/pythonnet --user --egg

更新

使用 Pythonnet 2.5.1:

sudo apt update
sudo apt-get install clang
sudo apt install nuget
git config --global http.proxy http://my.proxy.address:port
/usr/bin/python3 -m pip install -U pycparser --user
/usr/bin/python3 -m pip install -U pythonnet --user

这篇关于在 Ubuntu 18.04 上安装 pythonnet,Python 3.6.7 64 位,Mono 5.16 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆