In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to package and deploy Python projects in Flask. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
1. Background
The corporate algorithm is written by python. Because the project calls the python algorithm remotely, when the project is deployed, the python project is packaged and deployed to the server at the same time. Since the current leader has not given me the server address, I will play with it locally with mac first.
2. Install ① in python environment. Download the installation package
Https://www.python.org/downloads/release/python-374/
two。 Installation
This step is all stupid installation. Continue directly, and then open the command line and type python, which is not the correct version. Entering python3 is the version that has just been installed. Here, mac comes with python.
Enter open ~ / .bash_profile from the command line
The configuration in the file is as follows
Export PATH=$ {PATH}: / Library/Frameworks/Python.framework/Versions/3.7/binalias python= "/ Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"
Finally, enter source ~ / .bash_profile to take effect
3. Project dependent package installation
Since the project relies on a lot of third-party packages, download and install pyinstaller
Pip3 install pyinstaller
Install flask
Pip3 install-I https://pypi.tuna.tsinghua.edu.cn/simple/ flask
Install pandas
Pip3 install-I https://pypi.tuna.tsinghua.edu.cn/simple/ pandas
Install matplotlib
Pip3 install-I https://pypi.tuna.tsinghua.edu.cn/simple/ matplotlib
Finally install sklearn
Pip3 install-I https://pypi.tuna.tsinghua.edu.cn/simple/ sklearn
4. Flask package
Execute the pyinstaller-F main.py command in the sibling directory of the main.py file, and see successfully. After that, it means complete. At the same time, the following files are generated
The above is how to package and deploy the Python project in the Flask shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.