我按照提供的安装过程进行操作,但终端返回错误cython无法生成C中的代码
错误信息:
mkdir: cannot create directory ‘build’: File exists
Compiling /home/avss/git and other softs/torghost/torghost.py
/home/avss/.local/lib/python3.11/site-packages/Cython/Compiler/Main.py:344: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/avss/git and other softs/torghost/torghost.py
tree = Parsing.p_module(s, pxd, full_module_name)
[Errno 13] Permission denied: '/home/avss/git and other softs/torghost/build/torghost.c'
[ERROR] Build failed. Unable to generate C code using cython3
最初它返回 cython3 not found。我通过在虚拟环境中升级 cython (venv)
来解决这个问题我还更改了构建 shell 脚本以使其与 RPM 兼容。 由于 cython3 未被识别为二进制文件,因此我修改了 build.sh 脚本以调用 cython 函数。 但尽管如此,它还是返回了一个错误,“无法使用 cython 生成 C 代码”
原剧本:
echo "Torghost installer v3.0"
echo "Installing prerequisites "
sudo apt-get install tor python3-pip -y
echo "Installing dependencies "
sudo pip3 install -r requirements.txt
mkdir build
cd build
cython3 ../torghost.py --embed -o torghost.c --verbose
if [ $? -eq 0 ]; then
echo [SUCCESS] Generated C code
else
echo [ERROR] Build failed. Unable to generate C code using cython3
exit 1
fi
gcc -Os -I /usr/include/python3.8 -o torghost torghost.c -lpython3.8 -lpthread -lm -lutil -ldl
if [ $? -eq 0 ]; then
echo [SUCCESS] Compiled to static binay
else
echo [ERROR] Build failed
exit 1
fi
\sudo cp -r torghost /usr/bin/
if [ $? -eq 0 ]; then
echo [SUCCESS] Copied binary to /usr/bin
else
echo [ERROR] Unable to copy
ecit 1
fi
改变的脚本(修改后的脚本):
echo "Torghost installer v3.0"
echo "Installing prerequisites "
sudo dnf install tor python3-pip -y
echo "Installing dependencies "
sudo pip3 install -r requirements.txt
mkdir build
cd build
cython ../torghost.py --embed -o torghost.c --verbose
if [ $? -eq 0 ]; then
echo [SUCCESS] Generated C code
else
echo [ERROR] Build failed. Unable to generate C code using cython
exit 1
fi
gcc -Os -I /usr/include/python3.8 -o torghost torghost.c -lpython3.8 -lpthread -lm -lutil -ldl
if [ $? -eq 0 ]; then
echo [SUCCESS] Compiled to static binay
else
echo [ERROR] Build failed
exit 1
fi
sudo cp -r torghost /usr/bin/
if [ $? -eq 0 ]; then
echo [SUCCESS] Copied binary to /usr/bin
else
echo [ERROR] Unable to copy
ecit 1
任何帮助将不胜感激。 另外,如果我缺少任何要求,请告诉我。 谢谢你。