python - pip 不工作,引用/private/var 路径失败

标签 python pip

使用Python多年我还没有见过这个。当我尝试 pip install 时,它提示 /private/var。这是权限问题吗?

location-tools 是我尝试安装的 python 包的名称。我在虚拟环境中,但在虚拟环境之外却遇到了完全相同的错误。

    pip install .                                                                                                                             1   master 
Processing /Users/tommy/Development/python-location-tools
Building wheels for collected packages: location-tools
  Running setup.py bdist_wheel for location-tools ... error
  Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvTR-build/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 /var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/tmpm2DqL7pip-wheel- --python-tag cp27:
  Requirement already satisfied: gmplot==1.2.0 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 1))
  Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from gmplot==1.2.0->-r requirements.txt (line 1))
  Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
  Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
  Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
  Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/location_tools
  copying location_tools/__init__.py -> build/lib/location_tools
  copying location_tools/plotting.py -> build/lib/location_tools
  running build_scripts
  creating build/scripts-2.7
  error: file '/private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvTR-build/bin/ll_plot' does not exist

  ----------------------------------------
  Failed building wheel for location-tools
  Running setup.py clean for location-tools
Failed to build location-tools
Installing collected packages: location-tools
  Running setup.py install for location-tools ... error
    Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvTR-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-bggTuL-record/install-record.txt --single-version-externally-managed --compile:
    Requirement already satisfied: gmplot==1.2.0 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 1))
    Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from gmplot==1.2.0->-r requirements.txt (line 1))
    Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
    Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
    Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests->gmplot==1.2.0->-r requirements.txt (line 1))
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/location_tools
    copying location_tools/__init__.py -> build/lib/location_tools
    copying location_tools/plotting.py -> build/lib/location_tools
    running build_scripts
    creating build/scripts-2.7
    error: file '/private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvTR-build/bin/ll_plot' does not exist

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvTR-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-bggTuL-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v9/c461bkzn6r3ctmvg91df94c80000gn/T/pip-ROZvT

最佳答案

正如评论中提到的,这是您的 setup.py 中的错误。根据错误消息,setup.py 脚本似乎正在尝试访问 ll_plot 可执行文件。由于它说它不存在,因此您可能有一个入口 pip 脚本(通过 setuptools)或者正在尝试访问与 setup.py 或其他构建脚本相关的二进制可执行文件。

您需要检查所有脚本的 shebang,以确保它们没有尝试使用不存在的环境。当然,如果这是一个公共(public)包(或不是),您需要确保记录构建先决条件以及需要如何配置环境才能正确构建包。

关于python - pip 不工作,引用/private/var 路径失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47645081/

相关文章:

python - 在 Mac OS X 10.6.8 上使用 Homebrew 安装 Python 2.7 后使用 pip 时出现问题

python - 名称错误 : name 'argv' is not defined

python - namedtuple 字段在初始化期间的类型转换

python - brew 安装后 python (2.7.13) : [Errno 13] Permission denied

python - 如何使用 Pip (OS X) 在虚拟环境中安装 Python 包

python-3.x - python 3.6.10 pip3 TLS/SSL 未配置

plone - 为什么 "pip install Plone"失败并显示 "KeyError: ' z3c'"?

python - 我怎样才能 'de-merge' Pandas 数据帧产生 2 个不同的集合

python - 如何获取 pyd 文件的路径(又名相当于 __file__)

python - pandas dataframe 应用 lambda if else erro