天天看點

checking whether we are cross compiling... configure: error: in `/tmp/pip-build-rktAki/pycrypto解決方法

前文

  公司引入了阿裡雲centos,在新的阿裡雲上安裝salt的時候報錯如下,由于暫未更新到python3的salt,是以是直接用的pip install salt安裝,結果報錯,顯示configure error: cannot run C compiled programs!具體如下:

checking whether we are cross compiling... configure: error: in `/tmp/pip-build-rktAki/pycrypto解決方法

解決思路

  首先根據報錯說的,通過config.log檢視詳細報錯資訊,結果find / -name config.log并沒有找到。。。另一方面觀察到是/tmp下的pycrypto包出現異常,是以嘗試解除安裝重裝,結果仍舊報一樣的錯,顯示runtimeerror:autoconf error;是以懷疑是CPython包在C下編譯異常了,嘗試網上求解。

  在google搜了大量的資料,發現相關的甚少,并且嘗試了大量的操作(根據别人的解決方法安裝了大量包),發現都沒用。。。包括更新了pip、安裝了setuptools、安裝了development tools、安裝了gcc、安裝了gcc ++等等,結果都失敗;最後在如下的這篇stackoverflow裡提供了解決方法,連接配接如下:pycrypto installation: configure error: cannot run C compiled programs

  詳細内容截圖如下,根據大神的描述,需要修改/tmp這個挂載點,這裡采用的是第二種方法,即重建一個tmp的目錄,然後指定pycrypto到該目錄下:

checking whether we are cross compiling... configure: error: in `/tmp/pip-build-rktAki/pycrypto解決方法

  如果按照上述的方法安裝後仍舊報錯如下,這時再安裝python-devel,指令如下:

yum  install python-devel
           
checking whether we are cross compiling... configure: error: in `/tmp/pip-build-rktAki/pycrypto解決方法

  最後即可成功安裝salt:

checking whether we are cross compiling... configure: error: in `/tmp/pip-build-rktAki/pycrypto解決方法

總結

  涉及到linux的編譯、裝載的問題,還是有很多不懂,這些底層的知識還是要慢慢打磨!

繼續閱讀