简体   繁体   English

哪个目录 should.whl 将 go 打包到 Pycharm 项目中?

[英]Which directory should .whl packages go in a Pycharm Project?

I've been trying to import cx_Freeze into my Pygame project I'm making in PyCharm.我一直在尝试将 cx_Freeze 导入到我在 PyCharm 中制作的 Pygame 项目中。 I tried importing it the same way I imported Pygame (through the Project Interpreter) but "cx_Freeze" doesn't come up when I search for it.我尝试以与导入 Pygame (通过项目解释器)相同的方式导入它,但是当我搜索它时没有出现“cx_Freeze”。 So, instead I just downloaded the cx_Freeze package through the website.所以,我只是通过网站下载了 cx_Freeze package。

So, my question is: if I want to move the package from my Downloads Folder into my project via Explorer, which directory should it go into?所以,我的问题是:如果我想通过资源管理器将 package 从我的下载文件夹移动到我的项目中,它应该 go 到哪个目录? My first instinct is to put it in venv/Lib/site-packages (where pygame is) but I don't want to mess with things I don't fully understand.我的第一直觉是将它放在 venv/Lib/site-packages 中(pygame 所在的位置),但我不想弄乱我不完全理解的东西。

Don't copy the whl file, install it instead.不要复制 whl 文件,而是安装它。 Open a terminal from Pycharm, it will open it with your project interpreter, then find from the terminal the wheel file and run:从 Pycharm 打开一个终端,它会用你的项目解释器打开它,然后从终端找到轮子文件并运行:

python -m pip install wheel                        # only first time
python -m pip install wheel_file.whl               # for each library you want to install

This is the correct way of installing wheel files and it will ensure all required modules and hooks are met.这是安装轮文件的正确方法,它将确保满足所有必需的模块和挂钩。

do

import sys
print(sys.path)

and it can be in any of the path shown它可以在显示的任何路径中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM