conda virtual environment installation
List item
conda env list #View installed virtual environments
It's very easy for coda to create virtual environments: official tutorial:/projects/conda/en/latest/user-guide/tasks/
Here's an example of a storm_control installation
1. View installed virtual environments
conda env list
You can find the installed virtual environments in Anaconda3/envs/"my_name" by default.
2. Install a new virtual environment:conda create --name myenv python=3.6
Myenv is our own name.
3. Activate the virtual environment: activate myenv
4. Installation requires the package:
$ conda install --name myenv numpy pip pillow pywin32 pyserial scipy $ conda install --name myenv tifffile -c conda-forge (/pypi/tifffile) $ pip install PyQt5 (/software/pyqt/download5/) $ pip install PyDAQmx (/PyDAQmx/)
5. If we want to use our own files, but the files are on another very complex directory, generally speaking temporarily add.
import sys (something) #something is the path to the file you need to use
But the way to do it once and for all is to create a new .pth file in the virtual environment myenv/Lib\site-packages, and add the project path in it
E:\ketizu\paper\code\storm-control-master\
The reason is that if python encounters a .pth file during the traversal of a known library directory, it will add the path recorded in the file to the setup, and so the library indicated by the .PTH file can be found by the python runtime environment;
Where its pth file is placed:
import site () ()
file is used to read the configuration
xml is the abbreviation of Extensible Markup Language (Extensible Markup Language), mainly used to transfer and store data;
python install
This latter install is very important.
win10
echo %PATH%
Third-party package management
trails
is the set of paths for the python search module, a list. if we try to type inside conda:
import sys
Output results:
1
As you can see there is a site-packages folder, this file is mainly managed third-party package files.
If we want to install our own module
1. There is a once-and-for-all method, is to add a site-packages inside the pth file (pth file can be commented), where you want to add the path of the module, then the system will be able to search by pth.
You must have __init__.py inside the module you installed yourself.
2. Use to add a temporary path, after exiting python, you still need to re-add it next time.
The site-packages directory is the directory where third-party packages and modules are installed. If you install your code manually, it will be installed into the site-packages directory. Although the .pth file used to configure the path must be placed in site-packages, the path it configures can be any directory on the system that you wish. Thus, you can place your code in a range of different directories, as long as those directories are included in the .pth file.
When we try to load a module, python searches for the corresponding .py module in the specified path and reports an error if it can't find it;
By default, the Python interpreter searches the current directory, all installed built-in and third-party modules, with the search path stored in the path variable of the sys module:
summarize
The above is a small introduction to the python conda operation method, I hope to help you, if you have any questions please leave me a message, I will reply to you in a timely manner. Here also thank you very much for your support of my website!
If you find this article helpful, please feel free to reprint it, and please note the source, thank you!