docker-machine create -d virtualbox test遇到的坑3

开启VT-x 以后,重新执行docker-machine create -d virtualbox test

Error with pre-create check: "Get https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso: EOF"
因为是外网,所以下载很慢。 如果需要boot2docker.iso的话,可以 关注我,私信。用网盘分享给你

cd /mnt/hgfs/gx/

ls

cp boot2dokcer.iso /root/.docker/machine/cache

zrong@zrong-VirtualBox:~/raweye$ python setup.py install /usr/lib/python3/dist-packages/setuptools/dist.py:744: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section) /usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() /usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! self.initialize_options() error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib/python3.12/dist-packages/test-easy-install-9068.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python3.12/dist-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html Please make the appropriate changes for your system and try again. zrong@zrong-VirtualBox:~/raweye$ 安装报错
最新发布
05-22
### 权限 Denied 和 Setuptools 弃用警告解决方案 当运行 `python setup.py install` 出现权限拒绝 (`Permission denied`) 或者 setuptools 的弃用警告时,通常是因为以下几个原因: 1. **目标目录缺少写入权限**:尝试向系统级路径(如 `/usr/local/lib/pythonX.Y/site-packages/`)写入文件而未使用超级用户权限。 2. **Setuptools 版本过低**:较新的 Python 包可能依赖于更高版本的 setuptools 功能,这可能导致不兼容或发出弃用警告。 以下是具体的解决方法: #### 方法一:通过虚拟环境隔离安装 创建并激活一个独立的虚拟环境可以有效避免全局安装带来的权限问题。 ```bash # 创建虚拟环境 python3 -m venv myenv # 激活虚拟环境 source myenv/bin/activate # 升级 pip 和 setuptools pip install --upgrade pip setuptools wheel # 使用 setup.py 安装包 python setup.py install ``` 此方式不会影响系统的默认 Python 配置,并且无需管理员权限即可完成安装[^2]。 --- #### 方法二:指定本地用户目录安装 如果不希望使用虚拟环境,可以通过 `--user` 参数将包安装到用户的家目录下: ```bash python setup.py install --user ``` 这种方式会将包安装至 `$HOME/.local/lib/pythonX.Y/site-packages/` 下,从而绕开系统级别的权限限制[^1]。 --- #### 方法三:调整目标路径 如果需要自定义安装位置,则可以在运行 `setup.py` 命令时显式设置目标路径: ```bash python setup.py install --prefix=/desired/path ``` 之后需确保该路径被加入到 `PYTHONPATH` 中以便程序能够找到已安装的模块[^5]。 --- #### 方法四:修复 Setuptools 弃用警告 对于 setuptools 发出的弃用警告,建议先更新其至最新版再重试安装操作: ```bash pip install --upgrade setuptools ``` 部分情况下还需要清理缓存以防止残留数据干扰新版本的功能加载: ```bash rm -rf ~/.cache/pip/ ``` 此外,在某些特殊场景下(比如 Docker 环境),还需确认基础镜像中的开发工具链是否完备以及是否存在冲突性的库版本约束条件[^3]。 --- #### 示例代码片段验证流程 下面提供一段简单的脚本来测试上述更改后的效果: ```python import sys from distutils.core import setup setup( name="test_package", version="0.1", py_modules=["test_module"], ) print(f"Python Version: {sys.version}") try: __import__("setuptools") except ImportError as e: print("Error:", str(e)) else: print("Setuptools imported successfully.") ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值