0

我正在尝试在我的 Mac OS 上的 Mu 编辑器中安装第三方模块,并且我正在按照“使用 Python 自动化无聊的东西”的说明进行操作(这是我正在遵循的说明的链接:https ://automatetheboringstuff.com /2e/附录/ )

我现在正在尝试在我的 Mu 编辑器中安装我刚刚在 Python 3 中安装的相同模块,所以我从终端转到名为“automate-mac-requirements.txt”的文件所在的文件夹,然后运行下面的命令:

pip3 install –r automatic-mac-requirements.txt --target /Applications/mu-editor.app/Contents/Resources/app_packages

这是我收到的错误消息,我需要您的帮助(我想我需要帮助了解如何在 Python 和 Mu 编辑器上安装第三方模块):

ERROR: Command errored out with exit status 1:
 command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py'"'"'; __file__='"'"'/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka
     cwd: /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/
Complete output (49 lines):
running egg_info
creating /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info
writing include/pyobjc-compat.h to /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/include/pyobjc-compat.h
writing include/pyobjc-api.h to /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/include/pyobjc-api.h
writing /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/dependency_links.txt
writing namespace_packages to /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/namespace_packages.txt
writing top-level names to /private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/top_level.txt
writing manifest file '/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-pip-egg-info-6rm0vgka/pyobjc_core.egg-info/SOURCES.txt'
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py:369: DeprecationWarning: 'U' mode is deprecated
  with open(os.path.join('Modules/objc/', os.path.basename(basename)), 'rU') as fp:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py", line 692, in <module>
    setup(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py", line 361, in run
    egg_info.egg_info.run(self)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 297, in run
    self.find_sources()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 304, in find_sources
    mm.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 535, in run
    self.add_defaults()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 571, in add_defaults
    sdist.add_defaults(self)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 228, in add_defaults
    self._add_defaults_ext()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 311, in _add_defaults_ext
    build_ext = self.get_finalized_command('build_ext')
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 299, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/private/var/folders/7f/bd6jh1p12db7gggdnzvrsbhw0000gn/T/pip-install-eszre7tv/pyobjc-core/setup.py", line 532, in finalize_options
    self.sdk_root = subprocess.check_output(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/xcodebuild', '-version', '-sdk', 'macosx', 'Path']' returned non-zero exit status 1.
----------------------------------------

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

4

4 回答 4

1

我有同样的问题,这是解决它的最简单方法:

  • 单击 mu-editor 上的设置图标(右下角)
  • 单击“第三方包”选项卡
  • 在文本框中的新行上,写下您要安装的软件包的名称
  • 然后点击确定

然后第三方包安装在 mu 的虚拟环境中

这是 mu-editor 中对第三方包的简单支持。更多细节在这里

于 2021-09-28T12:03:12.880 回答
1

我也在阅读automatedTheBoringStuff2。

我一个一个地安装了每个包。例如模块 pyautogui:

pip3 install pyautogui --target /Applications/mu-editor.app/Contents/Resources/app_packages

确保指定要安装的版本。

运行 python 3.9,我在安装模块 pyobjc 时遇到问题。确保安装最新版本(截至 2021 年 1 月 27 日为 7.1 版)。

于 2021-01-27T19:05:17.350 回答
1

我相信您需要使用命令提示符窗口来安装它,而不是 MU。不过,我目前也遇到了通过该窗口安装这些的问题。

于 2020-08-11T21:08:43.570 回答
1

我在尝试使用本书提供的资源一次安装所有软件包时遇到了同样的问题。对我有用的是单独安装我需要的模块。

我做了以下事情:

  1. 在 pypi.org 上单独下载您需要的模块,在我的例子中是“pyperclip”。
  2. 将下载的文件夹(在我的情况下为“pyperclip-1.8.2”)移动到/Applications/mu-editor.app/Contents/Resources/app_packages(我没有最后一个文件夹“app_packages”,所以我自己创建了它工作)。
  3. 从文件夹 /Applications/mu-editor.app/Contents/Resources/app_packages 打开一个终端窗口。
  4. 类型:pip3 安装 pyperclip。
  5. 完毕!现在它起作用了,至少对我来说它起作用了。

我不确定这是否适用于任何其他模块,因为我还没有那么远。

于 2021-08-19T07:55:40.770 回答