class=”markdown_views prism-atom-one-dark”>
First of all, this problem is not too difficult, but this problem has troubled me all afternoon, I think it is necessary to record the troubled process!
I have never understood why the .bat and .exe files can be started directly in Powershell, as long as the path of my system Path is set, but why can’t the Yunxin.py file be launched directly?
This is a matter of principle, so Baidu is not easy to use. Later, I thought of a question “How to execute Python files in the Powershell terminal”, maybe this question can bring some answers, as expected, there is really an article (https: //segmentfault.com/q/1010000000651146), which mentioned ‘virtualenv’, although it is not clear, but just install this thing in the python installation path. Now do some less formal summaries:
The startup programs that powershell can call directly are .bat and .exe, but no matter what type it is, it is executed through a built-in command similar to cmdlet, and the py file is not in the interface of this built-in command, so The py file needs a virtual environment to solve this problem. This virtual environment is ‘virtualenv’, so now you can run the py file in powershell! ! ! !
I have done experiments, and the version of PYTHON will affect the normal use of virtualenv. For example, the Python3.6 I am using now is not very compatible, but everything will be normal if it is replaced with Python3.4