- Hands-On Neural Networks
- Leonardo De Marchi Laura Mitchell
- 252字
- 2021-06-24 14:00:10
Understanding virtual environments
While working with Python, you will probably use a multitude of libraries or packages. The virtual environment called venv is the first and most immediate way of making a working setup that is easy to reproduce.
From Python 3.3, the venv module is Python's built-in module, meaning you don't need to install any external components.
To create an environment in an automated way, it's necessary to create a list with all the libraries you want to install. Pip has a very simple way of defining this list, and it's enough to create a .txt file and specify one library per line.
To create the environment, you will need to perform the following steps:
- Install Python 3.7.
- Create a new environment called dl_venv_pip by using the following command:
python3.7 -m venv dl_venv_pip
- Specify the required libraries in a file that we will call requirements.txt
,
with the following content:
numpy==1.15.4
scipy==1.1.0
pandas==0.23.4
tensorboard==1.12.1
tensorflow==1.11.0
scipy==1.1.0
scikit-learn==0.20.1
Keras==2.2.4
- It's possible to now install all the required libraries with this command:
pip install -r /path/to/requirements/requirements.txt
- Now we can activate our environment by typing in the following command:
source dl_venv_pip/bin/activate
Once the environment is activated, all your calls to the Python interpreter will be redirected to the environment's interpreter. It's a quick and easy way to distribute the requirements, but it's still possible to have compatibility issues due to different operating systems, and also it might require some time to install all libraries as many data science projects rely on many of them.
- Big Data Analytics with Hadoop 3
- Hands-On Machine Learning on Google Cloud Platform
- 控制與決策系統仿真
- PIC單片機C語言非常入門與視頻演練
- 空間傳感器網絡復雜區域智能監測技術
- 自動生產線的拆裝與調試
- 大數據平臺異常檢測分析系統的若干關鍵技術研究
- Ceph:Designing and Implementing Scalable Storage Systems
- 網站入侵與腳本攻防修煉
- 啊哈C!思考快你一步
- 從零開始學Java Web開發
- 網絡脆弱性掃描產品原理及應用
- 手機游戲策劃設計
- Hands-On SAS for Data Analysis
- Natural Language Processing and Computational Linguistics