将脚本语言(例如Python)与Anaplan结合在一起,可以为您和您的团队在计划旅程中更大的灵活性和功能。如果您以前从未使用过Python,或者想查看Python和Anaplan的一些不同方式和用例,请不要再看一下,这一系列文章将引入此信息。
在进入所有这些方面,我们需要通过配置我们的Python环境来为成功做好准备。亚搏彩票手机版免费下载这只是一种可能的配置方法。
* You're running a relatively recent version of Windows (this guide was written with Windows 10 in mind, but should be fairly standard across recent versions of Windows). Apologies Mac and Linux users (although if you're running Linux, I hope you will manage).
* You have the ability to install things onto your machine, or you can get your IT administration team to help.
我们将首先在计算机上安装Python版本。最新版本的Python可以在其官方网站上找到:下载python |python.organd is currently 3.9.2. There are some differences between Python 2 and 3, so recommend installing a version (recent) of Python 3 if you're a beginner and don't need to support any legacy Python scripts.
根据组织的IT政策,您可能需要管理员来协助或将此安装打包到相关的软件部署软件包中。您要注意的一件事是确保将安装目录添加到系统路径中 - 这是安装步骤本身中的一个选项。
Rather than go too detailed into these installation steps, please refer to the official documentation for further installation steps:3. Using Python on Windows — Python 3.9.2 documentation.
Technically, you could stop here and start writing your own .py scripts and running them through the Python instance installed onto your computer. However, when starting out, it's useful to have a more feature-enabled code editor, that will allow us to effectively store, manage, debug and run our code. One such code editor is Visual Studio Code, which can be installed for free here:Visual Studio代码 - 代码编辑。重新定义。
这不需要管理员特权即可运行,因此应直接在本地配置文件下安装。但是,VS代码需要一些扩展才能真正发光。
您现在准备好配置Python环境了!
When working with Python projects, it is best practice to set up a "virtual environment" rather than using the globally installed environment. Luckily, this is pretty easy to do and explained well in-depth这里。
In short:
python -m venv .venv
This will create a new sub-folder called ".venv" which will store your virtual environment.
屏幕截图1:
屏幕截图2:
屏幕截图3:
Screenshot 3a: (note the(.venv)在线开始时为绿色)
你几乎已经完成!
To test that this has all been configured properly, in the same terminal window, enter the command:
PIP安装请求
Once this command completes, navigate to the file explorer in Visual Studio Code (icon labeled 1). Drill down into the ".venv" folder (this was automatically created when we ran the virtual environment setup command) and then further into "Lib" and then into "site-packages". In this list of folders, there should be a folder there called "requests".
Since we'll be making API calls using Python, we will need to install an extension library called "requests".pipis a package management system for Python and will be heavily utilized. The next article will go further into whatpipis, why it's useful, and how we'll continue to use it for extending our scripts.
现在,我们已经配置了Python虚拟环境,并且已安装了第一个软件包(请求),我们现在可以准备编写第一个脚本,以帮助我们进行一些工作区和模型管理。敬请关注!
Amazing@kevin.cho! Thanks for putting this out.
现在很高兴有记录,我们都可以将其作为资源参考
Quick question: Assuming a typical Windows installation, but for a *different* code editor besides Visual Studio Code, it sounds like would just adjust the part of configuring the virtual environment?
[using Windows 10 | Python 3.9x | Atom Text Editor (www.Atom.io)]
Hi@tedemancpa- the creation of the virtual environment should remain the same - in your terminal (if your code editor has an in-built one) or just Powershell (if using Windows), you can type in the same command to create the virtual environment.
VS Code automatically activates the environment, but this can be manually activated by running the command below
.\.venv\Scripts\activate
确保您的PowerShell会话在存储“ .venV”文件夹的本地目录中。
After this, running "python" in your terminal will use your virtual environment path.
直到这里完成。等待进一步学习。
谢谢
阿伦
Apologies for the delay@ArunManickam,开始一份新工作,一直很忙
下一篇文章将通过建立Anaplan模型,从而为您的Anaplan工作区提供鸟瞰图 - 工作区利用,模型尺寸等。
要创建子文件夹.venv我必须输入
python3 -m venv .venv