1024programmer Blog Run Python files directly in Powershell_powershell runs python_juzimeizi’s blog

Run Python files directly in Powershell_powershell runs python_juzimeizi’s blog

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

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/run-python-files-directly-in-powershell_powershell-runs-python_juzimeizis-blog/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索