擅长:python、mysql、java
<p>还要确保您已经创建了不带sudo命令的virtualenv,因为这可能会导致以后使用不带sudo的virtualenv的权限问题。如果是这种情况,请运行以下命令:</p>
<p><code>sudo chown -R your_username:your_username path/to/virtuaelenv/</code></p>
<p>然后,您可以为您的用户启用读取<code>/dev/ttyS10</code>的权限,并由该用户运行python脚本。在</p>
<p><strong>注意</strong>:您还需要将shebang line to添加到python脚本的顶部,并在env中提供python解释器的路径。这样你就可以不用翻译了。在</p>
<pre><code>#!/path/to/venv/bin python3
</code></pre>
<p>查看更多信息请回答:<a href="https://stackoverflow.com/questions/6908143/should-i-put-shebang-in-python-scripts-and-what-form-should-it-take">Should I put #! (shebang) in Python scripts, and what form should it take?</a></p>