gpt4 book ai didi

python - 设置配置文件和运行代码的问题

转载 作者:太空宇宙 更新时间:2023-11-04 12:38:04 25 4
gpt4 key购买 nike

我是 linux 的新手,正在尝试运行一些代码。试了几天没有成功,希望有人能帮帮我。我的Linux版本是

描述:Ubuntu 16.04.1 LTS 版本:16.04 代号:xenial代码可在此处找到:https://bitbucket.org/dsign/gecmi/wiki/Home

我的问题在于修改配置文件:site_config.py,开发人员说我应该:

检查此文件并以与您的构建环境、要编译的目标以及要安装它们的位置相匹配的方式对其进行编辑。首先,我尝试通过 apt-get 安装 boost、itbb、scons 和 numpy/scipy 库

sudo apt-get install libboost-dev
sudo apt-get install scons
sudo apt-get install python-scipy
sudo apt-get install python-numpy
sudo apt-get install libtbb-dev

我不确定这些版本是否正确,但这是我经过一番研究后可以找到的。

下一步是调整配置文件中的条目,但我发现很难(实际上我没有太多线索)在安装上述库后找出所有这些目录在哪里或如何分别适配这个配置文件:

# Use 'release' for speed, 'debug' for debugging.
COMPILE_MODE='release'
# Use one or both of the following words: 'standalone' for
# building the standalone executable, 'python' for building
# the python module
COMPILE_TARGETS='standalone python'
# Where the boost library is installed. I expect an 'include'
# and a 'lib' dir below.
BOOST_ROOT='/opt/boost_1_47_0/'
# The prefix of the python installation. This is used for deducing
# include directories and lib path of python
PYTHON_PREFIX="/usr/"
# The python's version. Used for deducing include directories and
# library name of python.
PYTHON_VERSION ="2.7"
# Where the Intel threading building blocks is installed. I expect
# and 'include' and a 'lib' directory below this one.
TBB_PREFIX="/home/alcides/programming/projects/sci_python/prx"
# The executable for the c++ compiler to use.
COMPILER_NAME="g++-4.6"
# The place where numpy is installed. I expect the directories
# 'core/include' and 'numarray/include' below.
NUMPY_PREFIX="/usr/local/lib/python2.7/dist-packages/numpy/"

# Where you sould like the standalone program to be installed
GECMI_PROGRAM_INSTALL_AT='/usr/local/bin'
# Where you would like the shared library to be installed. This
# library is used by both the python module and the standalone
# program.
GECMI_LIB_INSTALL_AT='/usr/local/lib'
# Where would you like to have the module installed, for the
# target 'InstallPythonModule'. A dll file called gecmi.{dllext}
# is installed there.
PYTHON_MODULE_INSTALL_AT='/usr/lib/python2.7/dist-packages'

作者的提示指出修改 LD_LIBRARY_PATH 变量,但对我帮助不大:

如果依赖项未正确安装,您可能会在加载共享库时收到此类错误消息。在这种情况下,您可能想要摆弄命令 locate 和环境变量 LD_LIBRARY_PATH,或者您选择的操作系统中的等效项。我尝试使用 whereis 和 locate,但不确定是否有效。例如,当我使用 whereis boost 或 locate boost 时,我发现了很多目录,但没有像 boost/include 或 boost/lib 这样的目录,这似乎是配置文件所期望的。对于 numpy,没有 numarray/include 文件夹 asf。

所以基本上我想知道 linux 高级用户如何找到所有必要的路径和目录并弄清楚如何让这段代码运行(或者如果你们中的一些人可以运行代码)。我也感谢有关如何更熟悉解决此类问题的更多信息/教程/建议。

谢谢!

最佳答案

在终端中写入以下命令

sudo apt-get update
sudo apt-get -y upgrade

python3 -V (out put is Python 3.5.2 may be or other version..)

sudo apt-get install -y python3-pip

pip3 install package_name

sudo apt-get install build-essential libssl-dev libffi-dev python-dev


sudo apt-get install -y python3-venv

如需更多帮助,请参阅这些网站

https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04

关于python - 设置配置文件和运行代码的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41075511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com