使用cond在Windows上构建Python包时出现奇怪的“拒绝访问”错误

2024-04-24 04:10:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用以下方法构建Chaco包:

conda build --numpy=1.16 --use-local conda.recipe\chaco

我在构建过程中遇到了一个非常奇怪的错误:

Using c:\programdata\anaconda3\conda-bld\chaco_1566078508037\_h_env\lib\site-packages
Searching for fonttools==3.44.0
Best match: fonttools 3.44.0
Adding fonttools 3.44.0 to easy-install.pth file
Installing fonttools-script.py script to %BUILD_PREFIX%\Scripts
Installing fonttools.exe script to %BUILD_PREFIX%\Scripts
error: [WinError 5] Access is denied: 'C:\\ProgramData\\Anaconda3\\conda-bld\\chaco_1566078508037\\_h_env\\Scripts\\font
tools.exe'

(%BUILD_PREFIX%) %SRC_DIR%>if errorlevel 1 exit 1
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\conda-build-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\cli\main_build.py", line 445, in main
    execute(sys.argv[1:])
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\cli\main_build.py", line 436, in execute
    verify=args.verify, variants=args.variants)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\api.py", line 209, in build
    notest=notest, need_source_download=need_source_download, variants=variants)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\build.py", line 2324, in build_tree
    notest=notest,
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\build.py", line 1439, in build
    windows.build(m, build_file, stats=build_stats, provision_only=provision_only)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\windows.py", line 294, in build
    check_call_env(cmd, cwd=m.config.work_dir, stats=stats, rewrite_stdout_env=rewrite_env)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\utils.py", line 397, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\utils.py", line 377, in _func_defaulting_env_to_os_enviro
n
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['cmd.exe', '/d', '/c', 'conda_build.bat']' returned non-zero exit status 1.

但是,当我检查C:\ProgramData\Anaconda3\conda-bld\chaco_1566078508037\_h_env\Scripts\目录的内容时,我看到fonttools.exe文件:

^{pr2}$

所以,很明显,构建过程是被拒绝访问的。在

当这第一次发生的时候,我想,“啊哦!已损坏的Anaconda3安装。“ 所以,我卸载了Anaconda3,确保所有Windows(7-Pro)更新都是最新的,重新启动并重新安装了Anaconda3。 我也犯了同样的错误!在

我的conda.recipe\chaco\meta.yaml文件的内容,供参考:

package:
  name: chaco
  version: "4.8.0"

source:
  path: ../../chaco/
  # fn: chaco-4.6.1.tar.gz
  # url: https://pypi.python.org/packages/d8/5f/82539366bb321f6f07fada6278e320bb52916a36b43fbe0e30e5ef9f9166/chaco-4.6.1.tar.gz
  # md5: d28117730f942f7cecb281b07abac3f4
#  patches:
   # List any patch files here
   # - fix.patch

build:
  # noarch_python: True
  # preserve_egg_dir: True
  # entry_points:
    # Put any entry points (scripts to be generated automatically) here. The
    # syntax is module:function.  For example
    #
    # - chaco = chaco:main
    #
    # Would create an entry point called chaco that calls chaco.main()


  # If this is a new build for the same version, increment the build
  # number. If you do not include this key, it defaults to 0.
  number: 2

requirements:
  build:
    - python
    - setuptools
    - enable >=4.8.0,<4.9
    - cython
    - pillow

  run:
    - python
    - enable >=4.8.0,<4.9
    - cython
    - pillow

test:
  # Python imports
  imports:
    - chaco
    - chaco.contour
    - chaco.downsample
    - chaco.downsample.tests
    - chaco.layers
    - chaco.overlays
    - chaco.plugin
    - chaco.scales
    - chaco.scales.tests
    - chaco.shell
    - chaco.tests
    - chaco.tools
    - chaco.tools.tests
    - chaco.tools.toolbars
    - chaco.ui

  # commands:
    # You can put test commands to be run here.  Use this to test that the
    # entry points work.


  # You can also put a file called run_test.py in the recipe that will be run
  # at test time.

  # requires:
    # Put any additional test requirements here.  For example
    # - nose

about:
  home: http://docs.enthought.com/chaco
  license: BSD License
  summary: 'interactive 2-dimensional plotting'
  license_family: BSD

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml

还有我的bld.bat

"%PYTHON%" setup.py install 
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.

根据this post中的建议,我尝试卸载Anaconda3并重新安装“just for me”,其效果是在我的主目录下安装Anaconda3。 行为没有变化:仍然收到同一文件的“拒绝访问”错误:fonttools.exe。在

问题:有没有一种方法可以让我进入Chaco构建目录并手动完成构建/上传,这样我就可以在等待帖子回复的同时发布这个PyBERT更新的Windows版本?在


Tags: toinpybuildenvlibpackagesline