化学热反应动力学cantera + python 安装

您所在的位置:网站首页 cantera安装在python 化学热反应动力学cantera + python 安装

化学热反应动力学cantera + python 安装

2023-10-03 17:18| 来源: 网络整理| 查看: 265

python 在线安装库很慢 国内源: 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华中理工大学:http://pypi.hustunique.com/ 山东理工大学:http://pypi.sdutlinux.org/ 豆瓣:http://pypi.douban.com/simple/ note:新版ubuntu要求使用https源,要注意。 例如:pip3 install -i https://pypi.doubanio.com/simple/ mkl Installing on Windows Windows installers are provided for stable versions of Cantera. These installation instructions are for Cantera 2.4.0. Use these installers if you want to work with a copy of Python downloaded from Python.org. If you are using Anaconda / Miniconda, see the directions for conda. Choose your Python version and architecture On Windows, Installers are provided for Python 2.7, Python 3.5, Python 3.6, and Python 3.7. Python 3.7 is recommended unless you need to use legacy code that does not work with Python 3. You can install multiple Cantera Python modules simultaneously. Note that Cantera 2.4 will be the last version to support Python 2.7. Cantera supports both 32- and 64-bit Python installations. You need choose the matching Cantera installer for your Python version and machine architecture. The rest of these instructions will refer to your chosen version of Python as X.Y. If you are using Matlab, you must use the same architecture for Cantera and Matlab. Matlab defaults to 64-bit if you are running a 64-bit operating system. //安装python--; 官网下载安装包 Install Python Go to python.org. 64-bit: Download the most recent “Windows X86-64 MSI Installer” for Python X.Y. 32-bit: Download the most recent “Windows x86 MSI Installer” for Python X.Y. Run the installer. The default installation options should be fine. Python is required in order to work with .cti input files even if you are not using the Python interface to Cantera. Cantera can also be used with alternative Python distributions such as the Enthought Canopy distribution. These distributions will generally be based on the 64-bit version of Python 2.7, and will include Numpy as well as many other packages useful for scientific users. //安装一个vc Install the Visual C++ Redistributable for Visual Studio 2015 If you are using Python 3.5 or higher you can skip this step as this will have already been installed when you installed Python. Go to the Microsoft Visual C++ Redistributable Download Page. 64-bit: Download vc_redist.x64.exe 32-bit: Download vc_redist.x86.exe Run the installer. If this package is not installed, you will encounter the following error when importing the cantera module: ImportError: DLL load failed: The specified module could not be found. ///python 安装一个numpy 库 Install NumPy and optional Python packages Go to the Unofficial Windows Binaries for Python Extension Packages page. Download the most recent release (distributed as a “wheel” archive) of the 1.x series for Python X.Y that matches your Python architecture. In the filename, the digits after “cp” indicate the Python version, e.g. numpy‑1.11.2+mkl‑cp37‑none‑win_amd64.whl is the installer for 64-bit Python 3.7. The Windows installers for Cantera 2.4.0 require NumPy 1.10 or newer. From an administrative command prompt, install the downloaded wheel using pip, e.g.,: c:\python37\scripts\pip.exe install ;%USERPROFILE%\Downloads\numpy‑1.11.2+mkl‑cp37‑none‑win_amd64.whl; //这个从官网下载太慢了,从国内的源下载吧 powershell or cmd 窗口下: pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple     numpy pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple    mkl //很快就装好了 If you plan on using Cantera from Python, note that we highly recommend installing the conda package. If you plan to continue using this Python installation, you may also want to install IPython (an advanced interactive Python interpreter) and Matplotlib (a plotting library), which are also available from the above link (note that you may also need to download additional dependencies for each of these packages). Matplotlib is required to run some of the Python examples. ////cantera 要对结果作图,再给安装两个库 pip3 install -i https://pypi.doubanio.com/simple/ matplotlib pip3 install -i https://pypi.doubanio.com/simple/ ipython ///// okk!!! Remove old versions of Cantera Use The Windows “Add/Remove Programs” interface Remove both the main Cantera package and the Python module. The Python module will be listed as “Python X.Y Cantera …” Install Cantera Go to the Cantera Releases page. 64-bit: Download Cantera-2.4.0-x64.msi and Cantera-Python-2.4.0-x64-pyX.Y.msi. 32-bit: Download Cantera-2.4.0-x86.msi and Cantera-Python-2.4.0-x86-pyX.Y.msi. If you are only using the Python module, you do not need to download and install the base package (the one without Python in the name). Run the installer(s). 两个都要下载, 1.安装包:Cantera-2.4.0-x64.msi 2.安装了这个python 才能运行cnatera::Cantera-Python-2.4.0-x64-py3.7.msi. Configure Matlab (optional) Set the environment variable PYTHON_CMD From the Start screen or menu type “edit environment” and select “Edit environment variables for your account”. Add a New variable with PYTHON_CMD as the name and the full path to the Python executable (e.g., C:\python37\python.exe) as the value. Setting PYTHON_CMD is not necessary if the path to python.exe is in your PATH (which can be set from the same configuration dialog). //////安装python 勾选path ,自动创建环境变量,这里就不用建立了 /////powershell 中,输入:python ///////////////////////;;; ???///////////////////就可以了 如果跳出来一个app store 应用商店窗口,说明,用户变量里面,path 的值有一个关APP的太靠前了,往后挪以下,挪到建立的变量的后边。 Launch Matlab Go to File-;Set Path… Select Add with Subfolders Browse to the folder C:\Program Files\Cantera\matlab\toolbox Select Save, then Close. Test the installation /////mATLAB 作为编辑器也需要安装python,等工具。 ///////MATLAB 将 //Cantera 安装路径下的\Cantera\matlab\toolbox 包含matlab 路径下,就可运行了。 Python: import cantera gas = cantera.Solution('gri30.cti') h2o = cantera.PureFluid('liquidvapor.cti', 'water') 不报错,就可以,这个没有输出 Matlab: gas = IdealGasMix('gri30.cti') h2o = Solution('liquidvapor.cti','water') ////这个有输出。 返回小木虫查看更多



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3