ubuntu - 在 Ubuntu 18.04、Python 3.6.7 64 位、Mono 5.16 上安装 pythonnet 失败

标签 ubuntu proxy mono python-3.6 python.net

我想在 Ubuntu 上安装 pythonnet,但它失败了。

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

/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/Installation但它没有帮助。

所以这也失败了:

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

无论是否使用 --egg 选项,我都尝试过。

顺便说一句,我在代理服务器后面。所以我也尝试为 NuGet 设置代理服务器,请参阅 NuGet Behind Proxy :

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

知道我做错了什么吗?

最佳答案

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

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 - 在 Ubuntu 18.04、Python 3.6.7 64 位、Mono 5.16 上安装 pythonnet 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55058757/

相关文章:

Python OpenCV 多处理适用于 MacOS 和 Windows,但不适用于 Ubuntu

cntlm 错误 : Too many open files

php - 用PHP代码移动托管服务后出现错误

go - 我如何验证用户 :pass proxy in golang

C#计算在const和variable locals之间有所不同?

c# - 在 Windows 上,mkbundle 因链接器错误而失败

java - Windows XP 上 java 的逻辑字体 Monospaced 的 TrueType 字体是什么

ubuntu - AWS 实例的每小时备份

apache - apache 虚拟主机设置中的禁止错误

c# - Mono AOT 编译 - 如何获取 .so 文件?