簡體   English   中英

在Ubuntu下編譯Cx-Freeze

[英]Compiling Cx-Freeze under Ubuntu

整整一天,我一直在嘗試在Ubuntu 14.04下編譯cx-Freeze並且沒有運氣。 所以我放棄了,決定在這里問專家。

是)我有的

  1. Ubuntu 14.04
  2. Python 3.4
  3. python-dev,python3-dev,python3.4-dev安裝(我知道這個常見問題)
  4. cx-Freeze的來源4.3.3

我試過兩種方法:

  1. 從源頭安裝
  2. 由pip安裝

從源安裝

sudo python3 setup.py install

我得到了什么

許多

MyPath/cx_Freeze-4.3.3/source/bases/Console.c:24: undefined reference to `PyErr_Print'
MyPath/cx_Freeze-4.3.3/source/bases/Console.c:24: undefined reference to `Py_FatalError'

然后

collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1

通過pip安裝

sudo pip3 install cx-Freeze

我得到了什么

collect2: error: ld returned 1 exit status

錯誤:命令'i686-linux-gnu-gcc'以退出狀態1失敗

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cx-Freeze/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c954v7x6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cx-Freeze
Storing debug log for failure in /home/grimel/.pip/pip.log

並在pip.log中

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python3/dist-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cx-Freeze/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c954v7x6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cx-Freeze

所以,我希望你能幫我解決這個問題,非常感謝:)

setup.py字符串中

if not vars.get("Py_ENABLE_SHARED", 0):

替換為

if True:

感謝Thomas K.

來自cx_freeze / issues

下載

您需要下載源代碼

對於python 3.3和3.4:

  1. sudo apt-get install python3-dev

  2. sudo apt-get install libssl-dev

  3. 打開setup.py並更改該行

    if not vars.get("Py_ENABLE_SHARED", 0):

    if True:

  4. python3 setup.py build

  5. sudo python3 setup.py install

對於python 2.7:

  1. sudo apt-get install python-dev

  2. sudo apt-get install libssl-dev

  3. 打開setup.py並更改該行

    if not vars.get("Py_ENABLE_SHARED", 0):

    if True:

  4. python setup.py build

  5. sudo python setup.py install

GriMel的回答對我有用。 在cx_freeze為此發布更新之前,我將包含一系列步驟,您可以使用GriMels的解決方案來實現此功能。

# create and activate virtualenv (as desired)
virtualenv envs/test_cxfreeze
. ./envs/test_cxfreeze/bin/activate

# download cxfreeze; do not install yet 
mkdir src/ 
pip install --download=./src/ cx-freeze
tar zxvf ./src/cx_Freeze-4.3.4.tar.gz -C ./src/

# fix bug in setup.py
vim src/cx_Freeze-4.3.4/setup.py
84c84
<             if True:
---
>             if not vars.get("Py_ENABLE_SHARED", 0):

# install cxfreeze
pip install ./src/cx_Freeze-4.3.4/

我還打開了一個似乎是源回購的bitbucket問題。

https://bitbucket.org/anthony_tuininga/cx_freeze/issues/153/cx_freeze-434-compile-error-on-ubuntu-1404

看起來你可能會有拼寫錯誤

 sudo pip3 install cx-Freeze

 sudo pip3 install cx_Freeze

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM