安裝pyV8試圖在Ubuntu安裝PyV8,並鍵入命令時:錯誤從源ubuntu上
python setup.py build
然後它顯示這樣的錯誤:
error: command 'c++' failed with exit status 1
有人有溶液對這個?
安裝pyV8試圖在Ubuntu安裝PyV8,並鍵入命令時:錯誤從源ubuntu上
python setup.py build
然後它顯示這樣的錯誤:
error: command 'c++' failed with exit status 1
有人有溶液對這個?
這是我在我的Dockerfile中。以下內容在Debian Stretch上進行測試並在生產環境中運行。我建議使用我正在使用的PyV8/V8設置 - 我花了至少一個星期的時間來確定哪個組合不會導致內存泄漏。我還建議通讀討論和JSContext修復here和here。簡而言之,對PyV8的支持幾乎是不存在的 - 無論是將它當作玩具來使用,還是完全遵循這個配方,或者花費大量的時間和精力來分解回購並使其更好。如果從新開始,我推薦使用Node-JS,並通過一些使用Python的IPC方法進行通信。
ENV MY_HOME /home/forge
ENV MY_LIB $FORGE_HOME/lib
# preparing dependencies for V8 and PyV8
ENV V8_HOME $MY_LIB/v8
RUN apt-get update && \
apt-get install -y libboost-thread-dev \
libboost-all-dev \
libboost-dev \
libboost-python-dev \
autoconf \
libtool \
systemtap \
scons
# compiling an older version of boost, required for this version of V8
RUN mkdir -p $MY_LIB/boost && cd $MY_LIB/boost && \
wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz && tar -xvzf boost_1_54_0.tar.gz && cd $MY_LIB/boost/boost_1_54_0 && \
./bootstrap.sh && \
./b2 install --prefix=/usr/local --with-python --with-thread && \
ldconfig && \
ldconfig /usr/local/lib
# preparing gcc 4.9 - anything newer will lead to errors with the V8 codebase
ENV CC "gcc-4.9"
ENV CPP "gcc-4.9 -E"
ENV CXX "g++-4.9"
ENV PATH_BEFORE_V8 "${MY_HOME}/bin:${PATH}"
ENV PATH "${MY_HOME}/bin:${PATH}"
RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y gcc-4.9 g++-4.9 && \
mkdir -p ${MY_HOME}/bin && cd ${MY_HOME}/bin && \
ln -s /usr/bin/${CC} ${MY_HOME}/bin/gcc && \
ln -s /usr/bin/${CC} ${MY_HOME}/bin/x86_64-linux-gnu-gcc && \
ln -s /usr/bin/${CXX} ${MY_HOME}/bin/g++ && \
ln -s /usr/bin/${CXX} ${MY_HOME}/bin/x86_64-linux-gnu-g++
# compiling a specific version of V8 and PyV8, since older combos lead to memory leaks
RUN git clone https://github.com/muellermichel/V8_r10452.git $V8_HOME && \
git clone https://github.com/muellermichel/PyV8_r429.git $MY_LIB/pyv8 && \
cd $MY_LIB/pyv8 && python setup.py build && python setup.py install
# cleaning up
RUN PATH=${PATH_BEFORE_V8} && \
head -n -2 /etc/apt/sources.list > ${MY_HOME}/sources.list.temp && \
mv ${MY_HOME}/sources.list.temp /etc/apt/sources.list && \
apt-get update
ENV PATH "${PATH_BEFORE_V8}"
ENV CC ""
ENV CPP ""
ENV CXX ""
舊版本依賴於現已解散googlecode上,併爲Ubuntu 12.04製成:
export MY_LIB_FOLDER=[PUT-YOUR-DESIRED-INSTALL-PATH-HERE]
apt-get install -y libboost-thread-dev
apt-get install -y libboost-all-dev
apt-get install -y libboost-dev
apt-get install -y libboost-python-dev
apt-get install -y git-core autoconf libtool systemtap
apt-get install -y subversion
apt-get install -y wget
mkdir -p $MY_LIB_FOLDER/boost && cd $MY_LIB_FOLDER/boost && wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz && tar -xvzf boost_1_54_0.tar.gz
cd $MY_LIB_FOLDER/boost/boost_1_54_0 && ./bootstrap.sh && ./b2 install --prefix=/usr/local --with-python --with-thread && ldconfig && ldconfig /usr/local/lib
svn checkout -r10452 http://v8.googlecode.com/svn/trunk/ $MY_LIB_FOLDER/v8
export V8_HOME=$MY_LIB_FOLDER/v8
svn checkout -r429 http://pyv8.googlecode.com/svn/trunk/ $MY_LIB_FOLDER/pyv8
git clone https://github.com/taguchimail/pyv8-linux-x64.git $MY_LIB_FOLDER/pyv8-taguchimail && cd $MY_LIB_FOLDER/pyv8-taguchimail && git checkout origin/stable
apt-get install -y scons
cd $MY_LIB_FOLDER/pyv8 && patch -p0 < $MY_LIB_FOLDER/pyv8-taguchimail/patches/pyv8.patch && python setup.py build && python setup.py install
有同樣的問題,這個工作對我來說:
export LIB=~
apt-get install -y curl libboost-thread-dev libboost-all-dev libboost-dev libboost-python-dev git-core autoconf libtool
svn checkout -r19632 http://v8.googlecode.com/svn/trunk/ $LIB/v8
export V8_HOME=$LIB/v8
svn checkout http://pyv8.googlecode.com/svn/trunk/ $LIB/pyv8 && cd $LIB/pyv8 && python setup.py build && python setup.py install
解決方案在這裏發表評論 - https://code.google.com/p/pyv8/wiki/HowToBuild
使用格式和看起來,鏈接可以是代碼格式的一部分。固定! – Ernest 2015-09-17 08:19:21
我使用的是基於Debian的發行版。以下是我安裝PyV8(你需要 已經安裝的git):
CD的/ usr /股
須藤混帳克隆https://github.com/emmetio/pyv8-binaries.git
CD pyv8二進制代碼/
須藤解壓pyv8 -linux64.zip
須藤CP -a PyV8.py _PyV8.so在/ usr/bin中
您可以添加全在這裏安裝錯誤日誌? – Saurabh 2015-02-09 18:06:16
我使用本指南來安裝「PyV8」:[將PyV8引擎導入Python 2.7,簡單的方法](http://www.wikisecure.net/importing-pyv8-engine-into-python-v2-7-the-簡單的方法/)這對我有好處:) – RedDeath 2015-10-10 10:56:15