在 python 环境中安装 PROJ 时出现问题
Problem in installing PROJ in python environment
无法安装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-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环境必须安装)
PROJ 是一个 C 库,不是 Python 包,因此您不能使用 pip
安装它。
如果您只想使用来自 Python 的 PROJ,您可以使用 PyPROJ 并使用 pip install pyproj
安装它。在 MacOS、Linux 和 Windows 上,这将为您提供已经包含 PROJ 的预制轮子。
如果您尝试为 CartoPy 安装它(基于您的标签),您需要在 their install instructions.
之后单独安装 PROJ
无法安装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-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环境必须安装)
PROJ 是一个 C 库,不是 Python 包,因此您不能使用 pip
安装它。
如果您只想使用来自 Python 的 PROJ,您可以使用 PyPROJ 并使用 pip install pyproj
安装它。在 MacOS、Linux 和 Windows 上,这将为您提供已经包含 PROJ 的预制轮子。
如果您尝试为 CartoPy 安装它(基于您的标签),您需要在 their install instructions.
之后单独安装 PROJ