Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在PyCharm终端之外使用PyCharm解释器_Python_Import_Pycharm_Ide_Interpreter - Fatal编程技术网

Python 在PyCharm终端之外使用PyCharm解释器

Python 在PyCharm终端之外使用PyCharm解释器,python,import,pycharm,ide,interpreter,Python,Import,Pycharm,Ide,Interpreter,我正在测试一些库集成,我想在PyCharm的终端之外运行它。在移动到脚本目录后,我尝试了普通的python./client.py,但是响应说它找不到我的模块。我试图直接调用项目的“venv”文件夹中的解释器/venv/bin/python./core/client.py,但它再次告诉我它找不到模块。如何在PyCharm IDE之外使用此解释器 如果需要,项目的文件系统如下所示: - Sparro - core - __init__.py - client.

我正在测试一些库集成,我想在PyCharm的终端之外运行它。在移动到脚本目录后,我尝试了普通的
python./client.py
,但是响应说它找不到我的模块。我试图直接调用项目的“venv”文件夹中的解释器
/venv/bin/python./core/client.py
,但它再次告诉我它找不到模块。如何在PyCharm IDE之外使用此解释器

如果需要,项目的文件系统如下所示:

- Sparro
    - core
        - __init__.py
        - client.py
        - packagers.py
        - queue_manager.py
        - server.py
        - utils.py
    - strategy
        - pairs.py
    - venv
        - bin
            - ...
            - python3
        - include
        - python3.8
            - site-packages

在pycharm项目文件夹中,如果在windows上打开cmd并运行命令
\venv\Scripts\activate
。如果您的电脑在mac/linux上运行,请打开终端并运行
source-venv/bin/activate
。这将使您处于该项目的虚拟环境中,您的脚本将能够使用您安装的模块


有关虚拟环境的更多信息,请查看此处的文档:

您需要激活您的环境,因此假设*nix,
source bin/activate