类型错误:内存视图:需要类似字节的对象,而不是“str”

问题描述 投票:0回答:1

设备:Macbook M1 Pro(arm64) 注意:我使用的是 zsh。我查看了之前提供的相关问题的解决方案,但仍然遇到相同的错误。 我尝试使用苹果硅 M1 64 位的 miniconda pkg 安装程序中的安装程序,但仍然遇到相同的错误。

我首先安装了 miniforge

自制安装--cask miniforge 然后我厌倦了初始化它。 我首先累了, conda 初始化 -dvv zsh 和, conda 初始化 -vv zsh 并得到同样的旧错误。

lucifer@Manojs-MacBook-Pro ~ % conda init -vv zsh
DEBUG conda.gateways.logging:set_verbosity(236): verbosity set to 2
DEBUG conda.gateways.subprocess:subprocess_call(78): executing>> /opt/homebrew/Caskroom/miniforge/base/bin/python --version


/Users/lucifer/.zshrc
--- 

+++ 

@@ -1,2 +1,18 @@

 
 echo "alias blender=/Applications/Blender.app/Contents/MacOS/blender"
+
+# >>> conda initialize >>>
+# !! Contents within this block are managed by 'conda init' !!
+__conda_setup="$('/opt/homebrew/Caskroom/miniforge/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
+if [ $? -eq 0 ]; then
+    eval "$__conda_setup"
+else
+    if [ -f "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
+        . "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh"
+    else
+        export PATH="/opt/homebrew/Caskroom/miniforge/base/bin:$PATH"
+    fi
+fi
+unset __conda_setup
+# <<< conda initialize <<<
+
INFO conda.core.initialize:run_plan(640): init_sh_user: PermissionError(13, 'Permission denied')
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/initialize.py", line 638, in run_plan
    result = globals()[step['function']](*step.get('args', ()), **step.get('kwargs', {}))
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/initialize.py", line 1331, in init_sh_user
    with open(user_rc_path, 'w') as fh:
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/common/compat.py", line 69, in open
    return io_open(file, str(mode), buffering=buffering,
PermissionError: [Errno 13] Permission denied: '/Users/lucifer/.zshrc'
DEBUG conda.gateways.subprocess:subprocess_call(78): executing>> sudo /opt/homebrew/Caskroom/miniforge/base/bin/python -m conda.core.initialize
Password:DEBUG conda.gateways.logging:set_verbosity(236): verbosity set to 2

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/exceptions.py", line 1129, in __call__
        return func(*args, **kwargs)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/main.py", line 86, in main_subshell
        exit_code = do_call(args, p)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/conda_argparse.py", line 93, in do_call
        return getattr(module, func_name)(args, parser)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/main_init.py", line 50, in execute
        return initialize(context.conda_prefix, selected_shells, for_user, args.system,
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/initialize.py", line 119, in initialize
        run_plan_elevated(plan2)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/initialize.py", line 688, in run_plan_elevated
        result = subprocess_call(
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/gateways/subprocess.py", line 100, in subprocess_call
        stdout, stderr = process.communicate(input=stdin)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/subprocess.py", line 1152, in communicate
        stdout, stderr = self._communicate(input, endtime, timeout)
      File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/subprocess.py", line 1983, in _communicate
        input_view = memoryview(self._input)
    TypeError: memoryview: a bytes-like object is required, not 'str'

`$ /opt/homebrew/bin/conda init -vv zsh`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/opt/homebrew/Caskroom/miniforge/base
           CURL_CA_BUNDLE=<not set>
                 INFOPATH=/opt/homebrew/share/info:
                  MANPATH=/opt/homebrew/share/man::
                     PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr
                          /sbin:/sbin:/Library/Apple/usr/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /Users/lucifer/.condarc
 populated config files : /opt/homebrew/Caskroom/miniforge/base/.condarc
          conda version : 22.9.0
    conda-build version : not installed
         python version : 3.10.6.final.0
       virtual packages : __osx=11.6=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /opt/homebrew/Caskroom/miniforge/base  (writable)
      conda av data dir : /opt/homebrew/Caskroom/miniforge/base/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /opt/homebrew/Caskroom/miniforge/base/pkgs
                          /Users/lucifer/.conda/pkgs
       envs directories : /opt/homebrew/Caskroom/miniforge/base/envs
                          /Users/lucifer/.conda/envs
               platform : osx-arm64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.10.6 Darwin/20.6.0 OSX/11.6
                UID:GID : 501:20
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]: DEBUG conda.gateways.logging:set_verbosity(236): verbosity set to 2

No report sent. To permanently opt-out, use

    $ conda config --set report_errors false
conda apple-m1 arm64 apple-silicon
1个回答
0
投票

对我来说,这个问题是通过使用 sudo 运行 bash 脚本解决的。

而不是跑步:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

我跑了:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
sudo bash Miniforge3-$(uname)-$(uname -m).sh

一切顺利。

© www.soinside.com 2019 - 2024. All rights reserved.