[英]A problem about install the python package
I want to use rawpy python package. 我想使用rawpy python包。 However, our docker is not allowed us to use pip, so I have to add the path of the rawpy.
但是,我们的泊坞窗不允许我们使用pip,因此我必须添加rawpy的路径。
Accroding to the instructions of our docker, I do these steps as follows: 根据我们码头工人的指示,我按以下步骤进行操作:
download the source of rawpy. 下载rawpy的源代码。 the link is : https://pypi.org/project/rawpy/#files
链接是: https : //pypi.org/project/rawpy/#files
I download the last one and unzip it. 我下载了最后一个并将其解压缩。 I put it in my folder /home/pylib
我把它放在我的文件夹/ home / pylib中
mount folder -v /home/pylib:/data/pylib 挂载文件夹-v / home / pylib:/ data / pylib
Add the following two lines of code at the beginning of my code: 在代码的开头添加以下两行代码:
import sys; sys.path.insert(1, '/data/pylib')
1 represents /data/pylib as having priority only lower than the directory in which my codes resides. 1表示/ data / pylib的优先级仅低于我的代码所在的目录。 At this point, the priorities of /data/pylib are higher than the system's own path, and import rawpy will imports rawpy in /data/pylib.
此时,/ data / pylib的优先级高于系统自身的路径,并且import rawpy将在/ data / pylib中导入rawpy。
But the rawpy source code have many .cpp files, such as _rawpy.cpp, and I got an error : `ModuleNotFoundError: No module named 'rawpy._rawpy' 但是原始的源代码有许多.cpp文件,例如_rawpy.cpp,并且出现错误:`ModuleNotFoundError:没有名为'rawpy._rawpy'的模块
It seems rawpy can be used if there exsist _rawpy.py, but there only exsist _rawpy.cpp in the rawpy folder. 如果存在_rawpy.py,但似乎可以使用rawpy,但rawpy文件夹中仅存在_rawpy.cpp。 What can I do?
我能做什么?
Rawpy is a Python module with a binary component which needs to be compiled; Rawpy是一个带有二进制组件的Python模块,需要对其进行编译; just downloading the source and plonking it in
sys.path
won't help (as you've noticed). 仅仅下载源代码并将其插入
sys.path
中将无济于事(您已经注意到)。
Are you absolutely sure you can't use pip
, even with the --user
flag (so it doesn't require root privileges)? 您是否绝对确定即使使用
--user
标志也不能使用pip
(因此它不需要root特权)?
If that is indeed the case, then you could try to download the suitable manylinux
wheel instead, rename the .whl
to .zip
and use that instead as you've done with /data/pylib
etc. The wheel will have the compiled binary extension too. 如果确实如此,那么您可以尝试下载适当的
manylinux
轮,将.whl
重命名为.zip
然后像在/data/pylib
等中所做的那样使用/data/pylib
。轮将具有已编译的二进制扩展名太。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.