1 回答
TA贡献1876条经验 获得超6个赞
在搜索主要错误消息的解决方案之后c++: error: unrecognized command line option '-R'
我所做的是使用强大的方法搜索相关文件find
:
andylu@andylu-ThinkPad-Edge-E130:~/Desktop/Python/Scripts$ sudo find / -type f -iname "unixccompiler.py"
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/tmp/.mount_pcloudgeFVGR’: Permission denied
/snap/core/9436/usr/lib/python3.5/distutils/unixccompiler.py
/snap/core/9665/usr/lib/python3.5/distutils/unixccompiler.py
/snap/gimp/281/usr/lib/python2.7/distutils/unixccompiler.py
/snap/gimp/273/usr/lib/python2.7/distutils/unixccompiler.py
/snap/core18/1880/usr/lib/python3.6/distutils/unixccompiler.py
/snap/core18/1880/usr/lib/python3.7/distutils/unixccompiler.py
/snap/core18/1880/usr/lib/python3.8/distutils/unixccompiler.py
/snap/core18/1754/usr/lib/python3.6/distutils/unixccompiler.py
/snap/core18/1754/usr/lib/python3.7/distutils/unixccompiler.py
/snap/core18/1754/usr/lib/python3.8/distutils/unixccompiler.py
/usr/lib/python3.8/distutils/unixccompiler.py
/usr/lib/python3.6/distutils/unixccompiler.py
/usr/lib/python3/dist-packages/numpy/distutils/unixccompiler.py
/usr/lib/python3.7/distutils/unixccompiler.py
/usr/lib/python2.7/distutils/unixccompiler.py
/usr/lib/python2.7/dist-packages/numpy/distutils/unixccompiler.py
find: ‘/home/andylu/pCloudDrive’: Permission denied
/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.5/libexec/setuptools/build/lib/setuptools/_distutils/unixccompiler.py
/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.5/libexec/setuptools/setuptools/_distutils/unixccompiler.py
/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/distutils/unixccompiler.py
/home/linuxbrew/.linuxbrew/Cellar/numpy/1.19.1/lib/python3.8/site-packages/numpy/distutils/unixccompiler.py
/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages/numpy/distutils/unixccompiler.py
/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages/setuptools/_distutils/unixccompiler.py
version 3.8接下来,我打开了包含当前在我的文本编辑器中使用的相关 python 文件VS Code。然后,我在这些文件中搜索“-R”以找到以下代码片段:
else:
if self._is_gcc(compiler):
# gcc on non-GNU systems does not need -Wl, but can
# use it anyway. Since distutils has always passed in
# -Wl whenever gcc was used in the past it is probably
# safest to keep doing so.
if sysconfig.get_config_var("GNULD") == "yes":
# GNU ld needs an extra option to get a RUNPATH
# instead of just an RPATH.
return "-Wl,--enable-new-dtags,-R" + dir
else:
return "-Wl,-R" + dir
else:
# No idea how --enable-new-dtags would be passed on to
# ld if this system was using GNU ld. Don't know if a
# system like this even exists.
return "-R" + dir
在这个代码片段中,我用"-R"和"-rpath="最后一个独立的"-R"(上面代码片段的最后一行)甚至用'-Wl,-rpath='. 完成后,代码片段如下所示:
else:
if self._is_gcc(compiler):
# gcc on non-GNU systems does not need -Wl, but can
# use it anyway. Since distutils has always passed in
# -Wl whenever gcc was used in the past it is probably
# safest to keep doing so.
if sysconfig.get_config_var("GNULD") == "yes":
# GNU ld needs an extra option to get a RUNPATH
# instead of just an RPATH.
return "-Wl,--enable-new-dtags,-rpath=" + dir
else:
return "-Wl,-rpath=" + dir
else:
# No idea how --enable-new-dtags would be passed on to
# ld if this system was using GNU ld. Don't know if a
# system like this even exists.
return "-Wl,-rpath=" + dir
保存并关闭上述修改后的python-scripts后,cartopy的安装终于成功了:
andylu@andylu-ThinkPad-Edge-E130:~/Desktop/Python/Scripts$ pip install cartopy
Collecting cartopy
Using cached Cartopy-0.18.0.tar.gz (14.4 MB)
Requirement already satisfied: numpy>=1.10 in /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages (from cartopy) (1.19.1)
Requirement already satisfied: shapely>=1.5.6 in /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages (from cartopy) (1.7.0)
Requirement already satisfied: pyshp>=1.1.4 in /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages (from cartopy) (2.1.0)
Requirement already satisfied: six>=1.3.0 in /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages (from cartopy) (1.15.0)
Requirement already satisfied: setuptools>=0.7.2 in /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages (from cartopy) (49.2.1)
Building wheels for collected packages: cartopy
Building wheel for cartopy (setup.py) ... done
Created wheel for cartopy: filename=Cartopy-0.18.0-cp38-cp38-linux_x86_64.whl size=15743039 sha256=b95932012d877432db8e629bdc77e730227f93f94515a54e59e4c6fb6a85bdad
Stored in directory: /home/andylu/.cache/pip/wheels/7c/3c/68/ed800c08e3e6579b632fdd26becee97c5c5474625f6c97eca6
Successfully built cartopy
Installing collected packages: cartopy
Successfully installed cartopy-0.18.0
添加回答
举报