1 回答

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊
在搜索主要錯(cuò)誤消息的解決方案之后c++: error: unrecognized command line option '-R'
我所做的是使用強(qiáng)大的方法搜索相關(guān)文件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接下來,我打開了包含當(dāng)前在我的文本編輯器中使用的相關(guān) 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
在這個(gè)代碼片段中,我用"-R"和"-rpath="最后一個(gè)獨(dú)立的"-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
保存并關(guān)閉上述修改后的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
添加回答
舉報(bào)