【问题标题】:Problem in installing PROJ in python environmentpython环境下安装PROJ的问题
【发布时间】:2021-03-05 05:46:33
【问题描述】:

无法安装PROJ

>>pip install git+https://github.com/OSGeo/PROJ.git

Collecting git+https://github.com/OSGeo/PROJ.git
  Cloning https://github.com/OSGeo/PROJ.git to c:\users\lenovo\appdata\local\temp\pip-req-build-jwr6msmg
    ERROR: Command errored out with exit status 1:
     command: 'c:\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\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 'C:\Users\lenovo\AppData\Local\Temp\pip-pip-egg-info-w2azftsy'
         cwd: C:\Users\lenovo\AppData\Local\Temp\pip-req-build-jwr6msmg\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\python37\lib\tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我尝试使用源文件手动安装它,但它也给出了以下错误

>>> pip install proj-7.1.1.tar.gz
Processing e:\wihg\15-09-2020\surfacewave tomography\iris_data\test\proj-7.1.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\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 'C:\Users\lenovo\AppData\Local\Temp\pip-pip-egg-info-2t2y4p78'
         cwd: C:\Users\lenovo\AppData\Local\Temp\pip-req-build-3y5iufx3\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\python37\lib\tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

如何解决这个错误? (非conda环境必须安装)

【问题讨论】:

  • 您能告诉我们 C:\Users\lenovo\AppData\Local\Temp\pip-req-build-jwr6msmg 中有什么数据下载了吗?目录没有创建吗?
  • 不!该目录未创建! :(

标签: python cartopy proj


【解决方案1】:

PROJ是C库,不是Python包,所以不能使用pip安装。

如果您只想通过 Python 使用 PROJ,您可以使用 PyPROJ 并使用 pip install pyproj 安装它。在 MacOS、Linux 和 Windows 上,这将为您提供已经包含 PROJ 的预构建轮子。

如果您尝试为 CartoPy 安装它(基于您的标签),您需要按照 their install instructions 单独安装 PROJ。

【讨论】:

    猜你喜欢
    • 2019-01-20
    • 1970-01-01
    • 1970-01-01
    • 2020-01-24
    • 1970-01-01
    • 2020-01-06
    • 1970-01-01
    • 1970-01-01
    • 2023-02-21
    相关资源
    最近更新 更多